django-admin startproject site
python manage.py startapp appname
- Edit
appname/views.py
- Edit
appname/urls.py
- Edit
site/urls.py
- Edit
site/settings.py
INSTALLED_APPS to include 'appname.apps.AppnameConfig'
- Edit
appname/models.py
python manage.py makemigrations appname
python manage.py migrate
python manage.py createsuperuser
- Edit
appname/admin.py
- Create these in
appname/templates/appname/
mkdir site/templates/registration
- Create templates
login.html
and logged_out.html
- Edit
site/urls.py
to include:
url(r'^', include('django.contrib.auth.urls')),
- Edit
site/settings.py
to include:
'DIRS': ['site/templates'] # inside the TEMPLATES dictionary
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'
- Guard views with
@login_required