Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been trying to make a simple app in Django for a while now and I noticed the following behaviours:

  1. Everytime I make changes to urls.py in my project folder, changes are not reflected until I restart http daemon. Why? Is there any way I can do without this?

  2. I tried to redirecting r'^staff/$' to staff.views.index (staff is my app name). But accessing /staff gave me a "Server Error", which on inspection of error_log showed "TemplateSyntaxError: Caught ImportError while rendering: No module named staff". What does this mean?

On removing that particular line from urls.py (and restarting httpd), accessing / reverted back to "It works" page. But, when I refresh the page after clearing all browsing data (including cache), I magically get back the page saying

Using the URLconf defined in myproj.urls, Django tried these URL patterns, in this order:
^staff/$
The current URL, , didn't match any of these.

This really puzzles me; how could it have possibly come back? I've tried to understand what's going on, but sadly, I've failed. At this rate, I might just go back to cakephp. I don't want to go back, help!

Background Information:

I run Apache with mod_wsgi on Arch Linux. myproj is my project name (located at /srv/http-django) and it has one app called staff (added to INSTALLED_APPS). My WSGI script adds /srv/http-django to sys.path and sets DJANGO_SETTINGS_MODULE to myproj.settings.

myproj/staff/views.py contains index function which simply returns "Hello, World!" as HttpResponse

share|improve this question

2 Answers 2

up vote 0 down vote accepted

For your first problem read:

http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

For the second problem, you could have a sys.path problem or more likely an import order dependency or problem due to naming of modules. If you are lucky using the alternate WSGI script file described in:

http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html

may help, but then it may not.

share|improve this answer

If you run mod_wsgi in Daemon mode you can update changes by touching the .wsgi file. (I've found this to be a bit flaky though)

share|improve this answer
    
There are no known issues with mod_wsgi daemon reloading mechanism. If you believe there is a problem have your reported it? –  Graham Dumpleton Jun 20 '11 at 5:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.