django-admin startproject project_name
cd into your project's root directory*
to start Django server
python manage.py runserver
an app is a directory containing code functionality able to live by itself apart from the other parts of the website
python manage.py startapp app_name
When Django finds a regular expression match, Django calls the
specified view function, with an HttpRequest object as the first argument
and any “captured” values from the regular expression as other arguments.
create a file called urls.py in your app directory and set urlpatterns
for example set / to point to index.html:
urlpatterns = [ url(r'^$', views.index, name='index'), ]
add urls.py in your app's directory and register to let it route its internal links:
url(r'^app_name/', include('app_name.urls'))
add a reference to its configuration class in the INSTALLED_APPS setting
'app_name.apps.AppnameConfig'
running makemigrations tells Django that you’ve made some
changes to your models and that you’d like
the changes to be stored as a migration.
python manage.py makemigrations polls
apply the migration
python manage.py migrate
bonus: get the SQL of a migration
read the SQL command to be execute before you apply the migration
python manage.py sqlmigrate app_name 0001
play with the django admin console:
python manage.py shell
python manage.py createsuperuser
and login at http://127.0.0.1:8000/login/
In app_name/admin.py, import the model
from .models import Modelname
register the model to the Admin
admin.site.register(Modelname)