I removed the file, and type in the terminal:
python manage.py migrate
python manage.py runserver
but still it doesn’t work:
I removed the file, and type in the terminal:
python manage.py migrate
python manage.py runserver
but still it doesn’t work:
What are the contents of your mysite/urls.py file?
mysite/mysite/urls.py
from django.contrib import admin
from django.urls import pathurlpatterns = [
path(‘admin/’, admin.site.urls),
]
Thank you very much for your help.
I replace this above by:
from django.contrib import admin
from django.urls import include, pathurlpatterns = [
path(‘polls/’, include(‘polls.urls’)),
path(‘admin/’, admin.site.urls),
]
Now i can see the polls page but i cannot se anymore the index page.
Any clue what to do ?
Your browser submits a request for a url. Django looks up that request in your urlpatterns. When it finds a matching pattern, it calls the view for that pattern.
So if you can’t see a specific view, what do you think the reason might be?
I guess that the view or the urlpattern doesn’t exsist.
Shoud I write the last line with something in replacement of “???”
from django.contrib import admin
from django.urls import include, pathurlpatterns = [
path(‘polls/’, include(‘polls.urls’)),
path(‘admin/’, admin.site.urls),
path(‘’, include(‘???’)),
]
How did you access the index page previously?
I don’t know.
I tried to do again te tuto and I notice that until I decomment the line with # the index page is no more accessible.
from django.contrib import admin
from django.urls import include, pathurlpatterns = [
#path(‘polls/’, include(‘polls.urls’)),
path(‘admin/’, admin.site.urls),
]
I am having the same problem. Did you find a solution to this?
I am also having the same issue.
I have tried and checked all the things mentioned above, but nothing seams to work.
@JerrySeba Welcome! If you’re looking for assistance with this issue, please open a new topic. When you do, include the contents of your urls.py file(s), a description of your directory structure (like you see above), and the url you are trying to access.
mysite
|--- manage.py
|--- mysite
|--- settings.py
|--- urls.py
|---__init__.py
|---asgi.py
|---wsgi.py
|--- polls
|--- apps.py
|--- views.py
|--- models.py
|--- urls.py
|--- test.py
|--- admin.py
|---__init__.py
|---migration
The code in mysite/mysite/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
And this is the code under mysite/polls/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]