我正在运行Ubuntu 18.04,python3.7和django2.1
当前仅在Mozilla的django教程的第2步:https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/skeleton_website
多次检查了我的代码,它与Mozilla的代码相同。
当我尝试运行python3.7 manage.py runmigrations
或python3.7 manage.py runserver
时,我得到:
TypeError: bad operand type for unary +: 'list'
我已经进行了四次检查,以确保我的代码与指南相同。
但是请发表评论,这对我以后发布代码是否有帮助。
locallibrary / locallibrary / urls.py
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
]
from django.views.generic import RedirectView
urlpatterns += [
path('', RedirectView.as_view(url='/catalog/')),
]
from django.conf import settings
from django.conf.urls.static import static
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Catalog / urls.py
from django.urls import path
from catalog import views
urlpatterns = [
]
这是我的回溯:
请一直向下滚动到“原始粘贴数据”
答案 0 :(得分:0)
这是我urls.py中的错字。我用= +代替+ =。谢谢@ ger.s.brett!