views:

511

answers:

3

The host I'm considering for hosting a Django site has mod_python installed, but does not have Django. Django's INSTALL file indicates that I can simply copy the django directory to Python's site-packages directory to install Django, so I suspect that it might be possible to configure Python / mod_python to look for it elsewhere (namely my user space) by modifying sys.path, but I don't know how to change it from .htaccess or mod_python.

How do I modify sys.path from .htaccess to allow mod_python to see Django?

P.S. I can only access the site via FTP (i.e. no shell access). I realize that it sounds like I should just switch hosts, but there are compelling reasons for me to make this work so I'm at least going to try.

+1  A: 

Is the PythonPath setting what you are looking for? I haven't tried it with Django, but I would assume that it should do the job for you.

D.Shawley
+3  A: 

According to ticket #2255 for Django, you need admin access to httpd.conf in order to use Django with mod_python, and this is not going to change, so you may be dead in the water. To answer the basic question of how to modify sys.path from .htaccess, you can use the PythonPath directive in .htaccess.

Rick Copeland
It looks like that ticket is from 2006... hopefully things have changed since then. I guess I'll see.
Kyle Cronin
+1  A: 

You're using mod_python wrong. It was never intended to serve python web applications. You should be using WSGI for this... or at least FastCGI.

Jeremy Cantrell
Thanks for the tip. Unfortunately, I'm constrained by what the host provides.
Kyle Cronin