On Nov 1, 9:15 pm, The End <airman.pr...@gmail.com> wrote:
> I've finally got mod_python and mysqldb working with apache (long
> story short, can't install wsgi for various reasons and i'm using
> python 2.4.3... for various reasons...).
>
> However
>
> Now when i load up the home page (just typing 'localhost' into
> firefox) i get the literal HTML representation of index.html, without
> the dynamics filling in.  I can only assume that apache is not using
> Django to return these requests.
>
> I only have 1 Virtual Host and Location tag in my entire Apache
> Configuration File (with all the standard stuff, i didn't turn
> anything off):
>
> LoadModule python_module /usr/lib64/httpd/modules/mod_python.so
>
> <VirtualHost "localhost">
>        ServerName Sweetman
>        ServerAdmin sweet...@sweetman.com
>        DocumentRoot /srv/www/sweetman/
>
>        <Location "/sweetman/">
>                SetHandler python-program
>                PythonHandler django.core.handlers.modpython
>                SetEnv DJANGO_SETTINGS_MODULE sweetman.settings
>                PythonDebug On
>                PythonPath "[ '/sweetman_live/sweetman' , '/usr/lib/
> python2.4/site-packages/django/' , '/srv/www/'] + sys.path"
>         </Location>
>
>         <Location "/site_media/">
>                SetHandler none
>         </Location>
>
>         ErrorLog /srv/www/sweetman/logs/error.log
>         CustomLog /srv/www/sweetman/logs/access.log combined
> </VirtualHost>

You've only set up mod_python to handle the 'sweetman' directory,  not
the root. Change the "Location" to "/".

Also note that it's a bad idea to keep your Django code and templates
under your DocumentRoot.  Apart from anything else,  it's a potential
security hole - if a misconfigured Apache can serve your templates
directly,  it could also do so with your settings file containing your
db credentials. Put it all somewhere else - it just needs to be on
your PythonPath,  which you're already modifying in the
configuration.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to