Koozali.org: home of the SME Server

Django + mod_Python on SME 7.3

Offline xboxer21

  • **
  • 60
  • +0/-0
Django + mod_Python on SME 7.3
« on: March 19, 2008, 03:54:02 PM »
I tried to get django working using mod_python but no dice yet. has anyone successfully got it working using mod_python?

Here is what i have done so far after reading through other threads specifically Mophilly's post.

I have added this fragment to the 80AddHandler00 template under /etc/e-smith/templates/etc/httpd/conf/httpd.conf/

Code: [Select]
<Location "/mysite/">
    SetHandler python-program
    PythonPath "['/usr/local/mydjangoproject'] + sys.path"
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mydjangoproject.settings
    PythonDebug On
    PythonAutoReload On
</Location>
And then ran the commands below

Code: [Select]
expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith restart

I get the following error when I try to access http://mysmeserver/mysite/

Code: [Select]
Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 287, in HandlerDispatch
    log=debug)

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 454, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named django

What am I doing wrong. Please help

Thanks!!
......

Offline Mophilly

  • *
  • 384
  • +0/-0
    • Mophilly
Re: Django + mod_Python on SME 7.3
« Reply #1 on: March 29, 2008, 05:26:25 PM »
I made a wiki page for setting up Django at http://www.mophilly.com/wiki/How_to_install_Django_on_SME_Server.

Please review it and see if the answer you seek is there. The error suggests that the django installation is not found by mod_python. This may be a problem with the path or perhaps a permissions error.

I am buried with project work at the moment, but I will try to make time to walk through the setup again to see if I can spot your error.

hth,

 - Mophilly
- Mark

Offline Marco Hess

  • *
  • 149
  • +0/-0
    • http://www.through-ip.com
Re: Django + mod_Python on SME 7.3
« Reply #2 on: March 30, 2008, 09:58:31 AM »
I am not familiar with Django, but Trac is launched/accessed in the httpd.conf file with something like this:

Code: [Select]
<Location /tracproject>

        SetHandler mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnv /home/e-smith/files/trac/tracproject
        PythonOption TracLocale en_AU
        PythonOption TracUriRoot /tracproject

        Options None
        AllowOverride None
        order deny,allow
        deny from all

    </Location>

Hope this helps...

Marco
Adelaide - Australia