- Install pre-requisites for the project depending on your operating system. Ubuntu is recommended as this is tested on Ubuntu 18.04 LTS. Ideally it should work on all OS, as that is the purpose of Dockers, but if you face any issues do raise a Github issue.
- Docker
- Docker compose - https://docs.docker.com/compose/install/
- Python 3
- Git
- Recommended IDE - VS code - but again doesn't really matter.
- Fork and clone this repo - the usual stuff.
- Even though this project is dockerised, its useful only for end to end testing and while deploying to Production. For local development it is still much faster to run django development server. So, I will divide the setup into Development and Docker section.
- After cloning the repo, change directory to app folder.
- Create a new Python3 virtual environment using venv (It's recommended for Python 3) named 'venv' (else change the vscode settings to point to proper environment name). - https://docs.python.org/3/library/venv.html
- Activate the virtual environment and install the required python libraries by running -
pip install -r requirements.txt
- Change current directory to api
- For any testing purpose, you can delete your sqlite3 db and run
python manage.py makemigrations
andpython manage.py migrate
to apply all changes to DB Schema - To load some initial data - for eq. a super user, run
python manage.py loaddata authentication/fixtures/superuser.json
to load the data present in superuser.json file. - This adds a superuser with email: admin@admin.com and password: admin
- Now you can run
python manage.py runserver
to start the django application. - Open http://127.0.0.1:8000/api to view the application.
- Open the terminal in root folder of the application. And run
docker-compose up
orsudo docker-compose up
depending on how docker is installed on your system. - This will install all the required containers and start the application.
- Open http://127.0.0.1:9000/api to view the application. (The difference in port is just because here the application goes through nginx first. This port can be changed in docker-compose.yml file)
The opened webpage looks as below if opened on Firefox
The secret keys and other info used in the app, but that cannot be put on source control should be present .env file inside folder api
Follow the instructions in .env.template to setup the .env file