0

This is my urls.py in my main project folder:

from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('polls.views',
   url(r'^$', 'mainindex'),
   url(r'^about/$', 'about'),
   url(r'^forum/', include('forum.urls')),
   url(r'^chatroom/$', include('jchat.urls')),
   url(r'^downloads/$', 'downloads'),
   url(r'^accounts/', include('registration.backends.default.urls')),
   url(r'^contact/$', 'contact'),
   url(r'^blogs/$', 'blogindex'),
   url(r'^blogs/(?P<blog_id>\d+)/$', 'blog'),
   url(r'^articles/$', 'articleindex'),
   url(r'^articles/(?P<article_id>\d+)/$', 'article'),
   url(r'^admin/', include(admin.site.urls)),
)

This is jchat.urls:

from django.conf.urls.defaults import *

import settings 



urlpatterns = patterns('',

    url(r'^$', 'jchat.views.test'),

    url(r'^send/$', 'jchat.views.send'),

    url(r'^receive/$', 'jchat.views.receive'),

    url(r'^sync/$', 'jchat.views.sync'),

    url(r'^join/$', 'jchat.views.join'),

    url(r'^leave/$', 'jchat.views.leave'),

    url(r'^chatroom/$', 'jchat.views.chatroom'),

    url(r'^simple/$', 'jchat.views.simple'),

    url(r'^complex/(?P<id>\d)$', 'jchat.views.complex'),

    url(r'^accounts/login/', 'django.contrib.auth.views.login',     {'template_name':'login.html'}),

url(r'^static/(?P<path>.*)$', 'django.views.static.serve',

       {'document_root': settings.STATIC_ROOT}),

)

I cannot see why it only displays mydomain.com/chatroom and correctly renders the test view, but does not render any other pages claiming that they are not specified in the urlconf. When I click on a link which should bring me the the simple view, it does not go to /chatroom/simple but instead /simple and it still says it does not exist in the urls.

Damian Stelucir
  • 55
  • 1
  • 4
  • 9

1 Answers1

0

Take a look at your your first own urlconf, not the jchat one:

url(r'^chatroom/$', include('jchat.urls')),

The only time that jchat.urls will get "included" is when the url is mydomain/chatroom.

To make this work just include it without the '/chatroom.'

like this:

url(r'^', include('jchat.urls')),

that line should be first in your urls.py.

James R
  • 4,571
  • 3
  • 30
  • 45
  • When I do that, that sets jchat as the index page which I do not want, although I have noticed that it was down to the $ on the include, I just got rid of that at it works now. Thanks. – Damian Stelucir Mar 27 '12 at 13:16