I am having this strange problem with my django project. I am now using Django with apache & mod_wsgi, trying to make it work in production mode, however the url redirect does't seems to work. I am only able to access the site-index page but not any sub-urls. i.e. if I go to site-url.com/quzapp/ it shows the index page, which is exactly the same as if I go to site-url.com/
When I run it on the dev server, everything works just fine. I am always directed to the desired page. The wired thing is there is no error logged even though I've set the log down to debug level in the apache configuration.
When I check the access_log it shows like:
"GET /quzapp/ HTTP/1.1" 200 1935 (the quzapp page)
"GET / HTTP/1.1" 200 1935 (the site index)
The log seems OK but I can not see any page other than the site_index.html... What could be wrong?
Here is the brief structure of the site: the project is called mysite with the main setting files sit in a sub directory also call mysite. quzapp is a django application.
mysite/
db.sqlite3
manage.py
mysite/
settings.py
urls.py
views.py
wsgi.py
quzapp/
__init__.py
urls.py
views.py
admin.py
forms.py
models.py
templates/
quzapp/
base.html
…...
template/
siteindex.html
…..
static/…
media/….
The main part of mysite/mysite/urls.py:
urlpatterns = patterns('',
url(r'^', views.index, name='index'),
url(r'^quzapp/',include('quzapp.urls')),
url(r'^admin/', include(admin.site.urls)),
)
The main part of the mysite/quzapp/urls.py:
urlpatterns = patterns('',
url(r'^$', views.initial_form, name='index'),
url(r'^allimage/$', views.allimage, name='allimage'),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^readytostart/$','questionnaires.views.register_success'),
url(r'^audio/$', views.audio, name='audio'),
url(r'^text/$', views.text, name='text'),
url(r'^end/$', views.endpage, name='endpage'),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()
I printed out some text to see if all the urls.py files are accessed and the answer is yes. The print command leaves text messages in error_log, which shows mysite/mysite/urls.py is accessed first then mysite/quzapp/urls.py is accessed.
In the mysite/mysite/views.py it returns render_to_response('siteindex.html'). I suppose this is how I got to access the siteindex page. The other pages are rendered in mysite/quzapp/views.py. Again I printed out some text message and in the error log, it shows the mysite/quzapp/views.py file is accessed after accessing the mysite/mysite/views.py.
I can't think of what's gone wrong and no error is logged, in the access log the status code is always 200 (ok). Does anyone have a clue about the problem?
Many thanks for your help!