It’s time for an app! We’ll run,

py manage.py startapp members

And it’ll create a members/ directory along with it’s contents!

We can create template like before but this time it’ll be inside of members/ directory

Untitled 4.png

Basic

it’s urls.py

from django.urls import path
from . import views
 
urlpatterns = [
    path('', views.index, name='index'),
]

and, views.py

from django.http import HttpResponse
from django.template import loader
 
def index(request):
  template = loader.get_template('myfirst.html')
  return HttpResponse(template.render())

it should work now!

Integration

access it’s setting and add the app, like,

# Application definition
 
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'members.apps.MembersConfig'
]

umm, members.apps.Members?

Untitled 2 2.png

finally, execute,

python manage.py migrate


Just putting the appname instead of app.apps.appconfig also works without migrate


and in the root urls.py

from django.urls import include, path
path('members/', include('members.urls')),

0 items under this folder.