Star Wars Challenge
This is an application which lists down star wars and their respective hyperdrives sorted in an ascending order.
Requirements for setting up the project.
- Python3.
- Flask
- Virtualenv.
- Redis.
You need to install redis on your machine, then afterwards you activate it.
This is the command you run on mac
brew services start redis
- Celery. This is also needed to perform some background processes, for this project,
celery is already in the
requirements.txt
file. - Docker. For easy deployment, you have to download
Docker
for containerizing our application.
Installation on Mac
First clone this repository
git clone https://github.com/huxaiphaer/starwars.git
Create a .env
file in the root directory and add the following :
REDIS_CONFIG=redis://redis:6379/0
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=1
REDIS_CHAR_SET=utf-8
REDIS_DECODE_RESPONSE=True
SECRET_KEY=anyname
Then, create a virtual environment and install in on Mac :
virtualenv venv
source venv/bin/activate
After activating the virtualenv
, then install the necessary dependencies :
pip3 install -r requirements.txt
Run docker :
docker-compose up --build
After, the above command finishes and it starts celery
beats, then route to http://localhost:5000/api/v1/starwars
Viola , then we can see our application routing to the api endpoint :-)
Running Tests
Running tests of the project :
nosetests
Running tests with coverage :
nosetests --with-coverage
Contributors
- Lutaaya Huzaifah Idris