Configuring mod_python and Djano on Apache2

0 views
Skip to first unread message

webhopper

unread,
Dec 29, 2008, 3:23:01 PM12/29/08
to Django users
Hello,

I am a new fan of Django. Enjoying the learning process. The tutorial
documentation is great. Where I am stuck is on how to move my
development project onto my public website which sits on Ubuntu 8.10.

I was able to configure mod_python and tell it where to find my Django
project and templates. Found this blog
http://www.jeffbaier.com/2007/07/26/installing-django-on-an-ubuntu-linux-server/
useful.

This is what I had in apache2.conf:

<location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE Test.settings
PythonPath "['/home/YOUR_USERNAME/django_projects'] + sys.path"
</location>

This works and I can see my Django site working. But here is the
problem. I have other stuff like MovableType running on same web
server, which I do not want to disrupt.

The way Apache gets configured if I follow instructions above seems to
be that EVERYTHING is seen by mon_python first and I am being required
to list all context roots that should NOT be handled by mod_python.
See for example below:


<location "/phpmyadmin">
SetHandler None
</location >

This is painful and does not scake as I consolidate more on same
server.

Is there a way top configure mod_python better?

Thanks in advance for any advice....

Best

Sreeram

tosh

unread,
Dec 30, 2008, 4:41:57 PM12/30/08
to Django users
it depends on the url structure of your site really

if you don't need your django site to load from the root you could
just do something like

<location "/">
SetHandler None
</location>

<location "/djangosite">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE Test.settings
PythonPath "['/home/YOUR_USERNAME/django_projects'] + sys.path"
</location>



On Dec 29, 2:23 pm, webhopper <sdu...@gmail.com> wrote:
> Hello,
>
> I am a new fan of Django. Enjoying the learning process. The tutorial
> documentation is great. Where I am stuck is on how to move my
> development project onto my public website which sits on Ubuntu 8.10.
>
> I was able to configure mod_python and tell it where to find my Django
> project and templates. Found this bloghttp://www.jeffbaier.com/2007/07/26/installing-django-on-an-ubuntu-li...

Graham Dumpleton

unread,
Dec 30, 2008, 4:46:30 PM12/30/08
to Django users


On Dec 31, 8:41 am, tosh <tosh...@gmail.com> wrote:
> it depends on the url structure of your site really
>
> if you don't need your django site to load from the root you could
> just do something like
>
> <location "/">
>     SetHandler None
> </location>

Don't need SetHandler None at root needed if mounting at sub URL. In
fact this may cause other things to stop working.

Graham
Reply all
Reply to author
Forward
0 new messages