Django:使用manage.py的TypeError [已回答,语法错误]

时间:2018-09-28 21:34:39

标签: django ubuntu-18.04 python-3.7 manage.py django-2.1

我正在运行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 runmigrationspython3.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 = [

]

这是我的回溯:

https://pastebin.com/2CzdtWzK

请一直向下滚动到“原始粘贴数据”

1 个答案:

答案 0 :(得分:0)

这是我urls.py中的错字。我用= +代替+ =。谢谢@ ger.s.brett!