Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 正在评估旧的列表视图_Django_Python 3.4 - Fatal编程技术网

Django 正在评估旧的列表视图

Django 正在评估旧的列表视图,django,python-3.4,Django,Python 3.4,我使用的是Windows10,Django1.11Python3.4 ` 在url.py中 url(r'^venues/(?P<pk>\w+)/$', VenueDetailView.as_view()), 当我输入url时,我得到 Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/venues/ Using the URLconf defined in bioskop.u

我使用的是Windows10,Django1.11Python3.4 `

在url.py中

url(r'^venues/(?P<pk>\w+)/$', VenueDetailView.as_view()),
当我输入url时,我得到

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/venues/
Using the URLconf defined in bioskop.urls, Django tried these URL patterns, in this order:
^admin/
^$
^venues/(?P<pk>\w+)/$
^about/$
^contact/$
The current path, venues/, didn't match any of these.

我不明白为什么它总是使用旧代码来呈现页面。

您是从
列表视图继承视图的。您可能需要将其更改为
DetailView

class VenueDetailView(DetailView):
另外,您需要更改您的url

url(r'^venues/(?P<pk>\d+)/$', VenueDetailView.as_view()),
url(r'^VICENTES/(?P\d+/$),VenueDetailView.as_view()),
\w+
-->
\d+

\w
匹配任何字母数字字符和下划线,即集合[a-zA-Z0-9]


\d
只匹配数字。

清除会话的控制台命令帮助我解决了这个问题。谢谢你的帮助

python manage.py clearsessions
url(r'^venues/(?P<pk>\d+)/$', VenueDetailView.as_view()),
python manage.py clearsessions