1

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

2 Answers 2

0

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.

0

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)

1
  • There are no known issues with mod_wsgi daemon reloading mechanism. If you believe there is a problem have your reported it? Jun 20, 2011 at 5:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .