Chris
Chris

Reputation: 12181

Django urls.py not found

Setting up the urls for a Django app called OmniCloud_App. Getting and error when accessing /OmniCloud_App/signup that the url is not found. here is the main urls.py:

urlpatterns = patterns('',
  (r'^OmniCloud_App/$', include('OmniCloud_App.urls')),
  (r'^admin/', include(admin.site.urls)),
)

which then includes 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'),
)

so signup should go to the signup method in views.py:

def signup(request):
    return render_to_response('OmniCloud_App/Templates/OmniCloud/signup.html', context_instance=RequestContext(request))

Any reason why this won't work? Here is the 404, which implies that it never got past the initial urls.py file, although visiting simply /OmniCloud_App/ renders the 'home' page correctly (which is also defined in the include('OmniCloud_App.urls')

urls.py 404 page

Upvotes: 0

Views: 339

Answers (1)

Cubed Eye
Cubed Eye

Reputation: 5631

You need to remove the $ from here

(r'^OmniCloud_App/$', include('OmniCloud_App.urls')),

so that it's:

(r'^OmniCloud_App/', include('OmniCloud_App.urls')),

The $ means end of string.

Upvotes: 7

Related Questions