我刚创建了一个新的Django视图。我在其他工作网址中添加了urls.py
的路径:
url(r'^events/new/$', 'crewcal.views.new_event', name='new_event'),
url(r'^commit/$', 'crewcal.views.commit'),
url(r'^user/(?P<user_id>\d+)/$', profile, name='profile'),
其他人工作正常。我已重新启动服务器并尝试发出请求,但我收到此错误。有人可以帮忙吗?
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/commit
Using the URLconf defined in ssc.urls, Django tried these URL patterns, in this order:
^$ [name='home']
^events/(?P<event_id>\d+)/$
^events/new/$ [name='new_event']
^user/(?P<user_id>\d+)/$ [name='profile']
^register/$ [name='join']
^login/$
^logout/$ [name='logout']
^log_in/$ [name='log_in']
^admin/
The current URL, commit, didn't match any of these.
答案 0 :(得分:0)
尝试删除.pyc文件并重新启动服务器。
find /path/to/project/ -name "*.pyc" -delete