🍡 Django Tutorial
Create Django App

Updated at 2018-11-23 18:16

Create "a Django app" (i.e. a feature set in your solution) named "polls": This "app" will focus on handling polls, the questions and voting.

python startapp polls

Edit polls/

from django.http import HttpResponse, HttpRequest

def index(request: HttpRequest):
    return HttpResponse("Hello, world. You're at the polls index.")

Create polls/

from django.urls import path

from . import views

urlpatterns = [
    path('', views.index, name='index'),

Edit djangor/ The include() function allows referencing route configurations of other installed apps in your Django project.

from django.conf.urls import include
from django.contrib import admin
from django.urls import path

urlpatterns = [
    path('polls/', include('polls.urls')),

Try out your new app:

python runserver
# navigate to http://localhost:8000/polls/