Step-by-Step for setting up Django with Docker:
-
Download Docker at https://www.docker.com -create an account
-
Clone this repository to your local machine. Create a folder called 'app' once done. Keep it empty.
-
Run: docker-compose build
-
Run: docker-compose run app sh -c "django-admin startproject first_project ." Run: docker-compose build
-
add '0.0.0.0' to ALLOWED_HOSTS in settings.py
-
cd into your 'app' folder and then run: docker-compose up
**** Not docker related ****
Finish setting up first application (order TBD)
- docker-compose run app sh -c "django-admin startapp first_app"
2)In views.py add a view called "index"
-
Create a urls.py in first_app folder. Add a 'urlpatterns' list
-
Update urls.py in first_project folder to link with urls.py in first_app folder
-
Create a 'templates' folder adjacent to 'first_project' and 'first_app' folder
-
Create and index.html page under 'first_app' folder to pair up with our views.py
-
Create TEMPLATE_DIR in settings.py