This is a brief explanation of how to wrap the project folder(generated by django startproject
) with our docker template folder.
After you start your project by following the Django official tutorial like:
django-admin startproject firsthomework #firsthomework is whatever you name your project
You will get a brand new directory named "firsthomework". You basically need to move everything out of that directory. The correct project layout should be:
docker-deploy
|—docker-compose.yml
|—nginx
| |—config
| |—web-app.conf
|—web-app
|—Dockerfile
|—requirements.txt
|—runserver.sh
|—initserver.sh
|—startserver.sh
|—manage.py
|—firsthomework
|—urls.py
|—settings.py
|—other stuff..
|....all your other directories for the project... (basically it will be the app directory once you create the app)`
To use docker, you must change the permission of the “runserver.sh” script in the "web-app" directory. To do this, go to the "web-app" directory and type this command:
chmod o+x runserver.sh