Django-docker source code.
For Running Project
-
Creating Project => django-admin startproject app
-
Create Application in Project => python manage.py startapp sample1
-
Changes in settings.py file of Project --
-
Define Views of application in views.py a. Views.py of sample1 => HomePageView()
-
Set URL's of Application in urls.py a. HomePageView() => localhost:8000/admin/
-
Make Migrations => python manage.py makemigrations python manage.py migrate sample1 python manage.py migrate
-
Run Server => python manage.py runserver
-
Finally, Send Requests to localhost
SAMPLE1 - Runs the first Hyperlink
For Building Docker Image
- docker build . (provided you are in the project's working directory)
- docker-compose build
- docker run -d -p 8000:8000 django_docker_app:latest