嗨,我是 Python 和 Django 的新手,我遵循django 研讨会指南。我刚刚安装了 Python 3.5 和 Django 1.9 并收到了很多错误消息......刚才我发现了很多文档但现在卡住了。我想添加视图,所以我在 urls.py 中添加了以下代码:
from django.conf.urls import include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Uncomment the admin/doc line below to enable admin documentation:
#url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^rezept/(?P<slug>[-\w]+)/$', 'recipes.views.detail'),
url(r'^$', 'recipes.views.index'),
]
并且每次都会收到错误消息:
Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got recipes.views.index). Pass the callable instead.
url(r'^$', 'recipes.views.index'),
但我找不到如何通过它们。文档仅告诉“通过它们”,但没有示例如何...