Swinging with Django
The mere mention of Django appears to have attracted a number of readers, which is very welcome, as apart from personal amusement, this blog is meant to be a resource for people who might also be trying to pull together the time, resource, information and motivation for their own project. It’s also nice to have my first comments, and the fact that they’re from people so closely associated with Django itself is rather heart-warming. Thanks for the welcome, guys!
This does have a down-side, of course, in that it means that it makes me a little more self-concious about the clumsy way I’m blundering around this whole web-dev/Python/Linux affair, but as a first step towards shaking that outlook, I’ll “complain” about Django. Well, not really a complaint, more of an explanation of a stumbling block that has shown itself.
As I mentioned before, I’ve installed from the Django source control, following the instructions, and gotten to a point where the django dev server functions, so I know the install is okay. However, I want to develop to my Apache mod_python setup, so I tried following the setup instructions for that. This results in the following error page:
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch log=debug)
File "/usr/lib64/python2.4/site-packages/modpython/apache.py", line 454, in importmodule f, p, d = imp.find_module(parts[i], path)
ImportError: No module named django
If I run python on the command line, I can “import django” without complaint, so this is still a bit of a mystery to me, and I’m presuming the answer lies somewhere in how mod_python works, but right now who knows? It’s something new to discover, if I want to be positive about it, or another time-sucking bump in the road otherwise. It is also probably something blindingly obvous, which will hopefully reveal itself to me after I’ve had some sleep.


Maybe you have multiple versions of Python installed, and modpython and the development server are finding different ones? Looks like modpython is using Python 2.4…
September 16th, 2005 at 5:56 amDid you ever figure out what the issue was with this? I’m having the exact same problem and Mr. Holovaty’s suggestion does not apply to my situation at least.
July 17th, 2006 at 11:32 amIn my next entry I mention that I “resolved” the issue by copying the django directories to my python site-packages directory. For some reason the symlink wasn’t working. I’m afraid I haven’t gone further in investigating why the symlink setup didn’t, there’s no reason for it not to.
July 17th, 2006 at 5:58 pmWell, in my case at least, it was a problem with apache2′s httpd.conf not including the correct directories for PythonPath. Honestly, given the nature of the issue, I would have expected a better error message. I’m sure that makes perfect sense to an experienced Djangoer, but some further hand holding would have been appreciated.
Thanks for your response in any case!
July 19th, 2006 at 1:12 am