6๐
โ
Your url conf regex is incorrect, you have to use $
instead of %
.
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
The $
acts as a regex flag to define the end of the regular expression.
๐คv1k45
1๐
I ran into the same issue with the tutorial!
The issue is that if you look closely it references two url.py files, mysite/polls/url.py and mysite/url.py.
Putting the provided code in the correct url.py files should correct the issue.
๐ค2-sticks
- Django ForeignKey limit_choices_to a different ForeignKey id
- Django Admin inline for recursive ManyToMany
0๐
Adding STATIC_URL and STATIC_MEDIA when debug is ON, helped me:
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^$', views.index, name='index'),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
๐คVova
- Django: Tweaking @login_required decorator
- Retrieving the 'many' end of a Generic Foreign Key relationship in Django
Source:stackexchange.com