APIs for Nabi Music project
Python 3.7.* PostgreSQL Postgis Docker and Docker Compose
- Create a database (default name is nabidb) and execute
CREATE EXTENSION postgis; CREATE EXTENSION hstore;
- Create a virtual environment and activate it
- Install packages with
pip install -r requirements.txt
- Copy nabi_api_django/env.example to .env. Update values in .env file (this file is skipped by git)
To generate a secret key, execute:
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
- Create a nabi_api_django/local_settings.py file including following keys (see staging_settings.py as example): SIMPLE_JWT, DEFAULT_FROM_EMAIL, ADMIN_EMAIL, SENDGRID_CONTACT_LIST_IDS, SENDGRID_EMAIL_TEMPLATES, HUBSPOT_CONTACT_LIST_IDS, AWS_S3_USAGE Include STATICFILES_DIRS if you have a directory containing static files that doesn't inside any app.
- Run RabbitMQ container using provided docker-compose.yml file with
docker-compose up -d
(can be shut down withdocker-compose down
) - Apply migrations with
python manage.py migrate
- Finally, to run backend project execute
python manage.py runserver
A request for execute a task is received by RabbitMQ container, and store it; for execution of these task, a worker should be executed.
To run a worker: celery worker -A nabi_api_django.celery_config -B -l info
Note: -B
option allow to execute scheduled tasks