Please enable JavaScript.
Coggle requires JavaScript to display documents.
Django, mysite/
manage.py
mysite/
init.py
settings.py
…
Django
Creating a project
- django-admin startproject mysite
-
Creating the Polls app
- python manage.py startapp polls
polls/views.py
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
polls/urls.py
from django.urls import path
from . import views
urlpatterns = [path('', views.index, name='index'),]
-
mysite/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns=[path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),]
-
-
-
mysite/settings.py
- module level variables of Django setting
Database setup
- SQLite (default)
- PostgreSQL
NAME
The name of your database
- SQLite db name-BASE_DIR / 'db.sqlite3'
- Other DataBase USER, PASSWORD, HOST
Engine
- django.db.backends.sqlite3
- django.db.backends.postgresql
- django.db.backends.mysql
- django.db.backends.oracle
- other backends
Initial editing to file
- Set TIME_ZONE
- INSTALLED_APPS
- setting at the top of the file
-
- mysite/
- manage.py
- mysite/
- init.py
- settings.py
- urls.py
- asgi.py
- wsgi.py
-
-
-
-
-
-
-
-
-