嗨,我开始新学django。我想将照片上传到我的网站。我做了其他部分,但在网址部分我得到了这样的错误。我该怎么办?
from django.contrib import admin
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from bildirge.views import contact, home
from bildirge.urls import *
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
from bildirge.views import ProfileImageView, ProfileDetailView, ProfileImageIndexView
urlpatterns = patterns[
url(r'^contact/', contact),
url(r'^home/', home),
url(r'^$', ProfileImageIndexView.as_view(), name='home'),
url(r'^upload/', ProfileImageView.as_view(), name='profile_image_upload'),
url(
r'^uploaded/(?P<pk>\d+)/$', ProfileDetailView.as_view(),
name='profile_image'),
url(r'^admin/', include(admin.site.urls))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
错误是
TypeError:'function'对象没有属性' getitem '
提前致谢
答案 0 :(得分:2)
在打开网址列表之前,你有一个迷路patterns
。删除它。