Derived from here
cd websites
django-admin startproject murdermystery
cd murdermystery
python3 manage.py runserver
hit ctrl+c to stop
Create a new script builder app
python3 manage.py startapp scriptbuilder
nano murdermystery/settings.py
See this section to pre-define a custom user class before creating any databases.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'script_builder.apps.ScriptBuilderConfig'
]
Update Database if necessary.
TIME_ZONE = 'UTC'
TIME_ZONE = 'America/Phoenix'
Edit URL mappings
nano murdermystery/urls.py
add to bottom
# Use include() to add paths from the catalog application
from django.urls import include
urlpatterns += [
path('script_builder/', include('script_builder.urls')),
]
# Use static() to add url mapping to serve static files during development (only)
from django.conf import settings
from django.conf.urls.static import static
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
save and close
Now paste the following into
nano script_builder/urls.py
from django.urls import path
from . import views
urlpatterns = [
]
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
Add models according to this page
nano script_builder/admin.py
from django.contrib import admin
# Register your models here.
from .models import Author, Genre, Book, BookInstance
admin.site.register(Book)
admin.site.register(Author)
admin.site.register(Genre)
admin.site.register(BookInstance)
python manage.py createsuperuser
python3 manage.py runserver
Go to localhost:8000/admin