I have followed the tutorial “Writing your first Django app, part 1 | Django documentation | Django”.
But I am stuck and don’t see my error.
I get this error:
I have this directory layout:
carsten@Oldman:~/projects/django4/mysite$ ll
insgesamt 24
drwxrwxr-x 4 carsten carsten 4096 Mär 29 11:25 ./
drwxrwxr-x 3 carsten carsten 4096 Mär 29 09:13 ../
-rw-r--r-- 1 carsten carsten 0 Mär 29 09:16 db.sqlite3
-rwxrwxr-x 1 carsten carsten 662 Mär 29 09:13 manage.py*
drwxrwxr-x 3 carsten carsten 4096 Mär 29 09:16 mysite/
drwxrwxr-x 3 carsten carsten 4096 Mär 29 11:24 polls/
-rw-rw-r-- 1 carsten carsten 170 Mär 29 11:25 urls.py
urls.py has this content:
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path(‘polls/’, include(‘polls.urls’)),
path(‘admin/’, admin.site.urls),
]
And under the folder polls this structure:
carsten@Oldman:~/projects/django4/mysite/polls$ ll
insgesamt 36
drwxrwxr-x 3 carsten carsten 4096 Mär 29 11:24 ./
drwxrwxr-x 4 carsten carsten 4096 Mär 29 11:25 ../
-rw-rw-r-- 1 carsten carsten 63 Mär 29 09:24 admin.py
-rw-rw-r-- 1 carsten carsten 142 Mär 29 09:24 apps.py
-rw-rw-r-- 1 carsten carsten 0 Mär 29 09:24 __init__.py
drwxrwxr-x 2 carsten carsten 4096 Mär 29 09:24 migrations/
-rw-rw-r-- 1 carsten carsten 57 Mär 29 09:24 models.py
-rw-rw-r-- 1 carsten carsten 60 Mär 29 09:24 tests.py
-rw-rw-r-- 1 carsten carsten 110 Mär 29 11:24 urls.py
-rw-rw-r-- 1 carsten carsten 127 Mär 29 11:22 views.py
with urls.py like this:
from django.urls import path
from . import views
urlpatterns = [
path(‘’, views.index, name=‘index’),
]
and views.py like this:
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
The "runserver" command shows this:
carsten@Oldman:~/projects/django4/mysite$ python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks…
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.
March 29, 2022 - 09:25:15
Django version 4.0.3, using settings ‘mysite.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /polls/
[29/Mar/2022 09:25:20] “GET /polls/ HTTP/1.1” 404 2095
Not Found: /polls/
[29/Mar/2022 09:26:14] “GET /polls/ HTTP/1.1” 404 2095
Not Found: /favicon.ico
[29/Mar/2022 09:26:14] “GET /favicon.ico HTTP/1.1” 404 2110
Can someone give me hint?