3👍
I think you either just need to use blank ‘ ‘ as the path for index
from django.contrib import admin
from django.urls import path
from first_app import views
urlpatterns = [
path('',views.index,name='index'),
path('admin/', admin.site.urls),
]
0👍
In Django 2.x.x, path()
does not accept regular expressions. If you want to use regular expressions then you can use re_path()
function like
from django.urls import path, re_path urlpatterns = [ re_path(r'^$',views.index,name='index'), path('admin/', admin.site.urls), ]
or simply use path()
as suggested by @Antimada. The best practice is to use path()
or at least avoid mixing both i.e. path()
and re_path()
.
- [Django]-Your PYTHONPATH points to a site-packages dir for Python 3.x but you are running Python 2.x
- [Django]-Django related key of the same model
- [Django]-Using Curl and Django Rest Framework in Terminal
- [Django]-How to use django default group permission in django-graphene?
Source:stackexchange.com