...
Go to the project folder (e.g.
/opt/ece_li_scheduling/ece_li_scheduling
) where thesettings.py
file is stored.In the
settings.py
file, add the name of the new app to theINSTALLED_APPS
list:Code Block INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', '<app name>', ]
In the
urls.py
file, direct all traffic for the new app to its.urls
file.Code Block urlpatterns = [ path('admin/', admin.site.urls), path('<app name>/', include('<app name>.urls')) ]
Note that
include
needs to be imported fromdjango.urls
.
Create urls.py
Since the project urls.py
directs traffic to the app, the app needs to handle this traffic with its own urls.py
file.
Create a
urls.py
file within the app folder. Here is an example,Code Block from django.urls import path from . import views urlpatterns = [ path('', views.home, name='home'), ]
Note that this example points to a
home
function in the app views, but this has not been created yet.
Create view
The app needs at least one view.
...