[英]Pointing to index.html in Django
我刚刚更新到较新版本的 django,现在无法指向我的 index.html 文件
这是我项目的结构
gradMVPV1
--> .idea
--> catalog
views
models
apps
....
--> gradMVPV1
settings
urls
wsgi
....
--> templates
---->index.html
db.sqlite3
manage.py
这是我的 settings.py 文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATE_DIR = os.path.join(BASE_DIR, '/templates')
网址.py
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.index, "index"),
]
和意见
def index(request):
return render(request, "index.html")
这是我的错误信息
ValueError at /
dictionary update sequence element #0 has length 1; 2 is required
Request Method:
GET
Request URL:
http://127.0.0.1:8000/
Django Version:
2.2.7
Exception Type:
ValueError
Exception Value:
dictionary update sequence element #0 has length 1; 2 is required
Exception Location:
C:\Users\User\Anaconda3\lib\site-packages\django\urls\resolvers.py in resolve, line 348
Python Executable:
C:\Users\User\Anaconda3\python.exe
Python Version:
3.7.4
修复path('', views.index, "index"),]
到path('', views.index, name = "index"),]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.