0
爲Django應用程序設置名爲OmniCloud_App
的網址。訪問/ OmniCloud_App /註冊找不到url時出現錯誤。這裏是主urls.py:Django urls.py找不到
urlpatterns = patterns('',
(r'^OmniCloud_App/$', include('OmniCloud_App.urls')),
(r'^admin/', include(admin.site.urls)),
)
然後包括OmniCloud_App/urls.py:
urlpatterns = patterns('OmniCloud_App.views',
(r'^', 'home'),
(r'^signup/', 'signup'),
(r'^(?P<User_id>\d+)/$', 'profile'),
(r'^(?P<User_id>\d+)/social$', 'social'),
(r'^(?P<User_id>\d+)/news$', 'news'),
(r'^(?P<User_id>\d+)/email$', 'email'),
(r'^(?P<User_id>\d+)/photos$', 'photos'),
)
所以註冊應該去註冊方法views.py:
def signup(request):
return render_to_response('OmniCloud_App/Templates/OmniCloud/signup.html', context_instance=RequestContext(request))
任何原因,這將無法正常工作?這裏是404,這意味着它從來沒有得到過初始urls.py文件,雖然正確地參觀簡單/ OmniCloud_App /渲染「主頁」(這在include('OmniCloud_App.urls')
啊挺好的。我曾嘗試過,但接受/ OmniCloud_App/*(任何字符串)我還需要添加$後註冊/ – Chris