I solved it by just starting over with copying my project from the development dir to the server dir. Then i fiddled with the pythonpath and got it to work.
I added the personal notes i took when solving the issue. Mind that sometimes there might not be lot's of info but as i said, these are my personal notes. Regards, Benedict Links: ====== http://www.djangoproject.com/documentation/modpython/ http://www.modpython.org/ http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking Path: ===== 1. Get apache to work with a simple site 2. Get apache to work with a simple site via virtual host 3. Get apache to work with mod_python 4. Get apache to work with django in a vhost Project structure ================= project: D:\development\django\<project> project structure: D:\development\django\<project> files: __init__.py, settings.py, urls.py, manage.py dirs: main, media, packages application dir: D:\development\django\<project>\<application> application structure: D:\development\django\<project>\<application> __init__.py, views.py, urls.py, models.py, <model>.py media structure: D:\development\django\<project>\media dirs: script, style templates structure: D:\development\django\templates project dir in templates: D:\development\django\templates\<project> D:\development\django\templates\<project>\<application> files: *.html Installation ============ 1. Install apache 2.2. -> I had an errror when apache ran: NameVirtualHost *:0 has no VirtualHosts Changed in httpd.conf: ServerName pcname.domain #DocumentRoot "D:/Apache2.2/htdocs" DocumentRoot "D:/sites" #<Directory "D:/Apache2.2/htdocs"> <Directory "D:/sites"> Added in httpd.conf: <Directory "D:/sitesdjango"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> Uncommented in httpd.conf Include conf/extra/httpd-vhosts.conf Include conf/extra/httpd-manual.conf Include conf/extra/httpd-default.conf In extra/httpd-vhosts.conf NameVirtualHost * <VirtualHost *> ServerAdmin [EMAIL PROTECTED] DocumentRoot D:/sites/gema DirectoryIndex index.html index.htm ServerName gema ErrorLog logs/gema-error.log CustomLog logs/gema-access.log common TransferLog logs/gema_access.log </VirtualHost> Check http://gema for a simple site (you just need a working index.html) or http://localhost/manual to ge the apache manual 2. Install mod_python Look for mod_python.so in D:\Apache2.2\modules 3. Test mod_python We assume that django is already working correctly. Adjustments to Apache (httpd.conf): LoadModule python_module modules/mod_python.so <Directory D:/sites/gema> AddHandler mod_python .py PythonHandler test PythonDebug On </Directory> Restart apache Script used to test mod_python: D:/sites/gema/test.py ===================================================== from mod_python import apache def handler(req): req.content_type = "text/plain" req.write("Hello World!") return apache.OK ================================ Test by going to: http://gema/test.py 4. Test django from mod_python Add to httpd.conf <Location "/mysite/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On </Location> or for a virtual host: <VirtualHost *> ServerName gema ServerAdmin [EMAIL PROTECTED] DocumentRoot D:/sitesdjango/gema DirectoryIndex index.html index.htm ErrorLog logs/gema-error.log CustomLog logs/gema-access.log common TransferLog logs/gema_access.log SetEnv DJANGO_SETTINGS_MODULE gema.settings SetHandler mod_python PythonHandler django.core.handlers.modpython PythonPath "[r'D:\sitesdjango',r'D:\sitesdjango\gema'] + sys.path" PythonDebug On Alias /media "D:/sitesdjango/gema/media" <Location "/media/"> SetHandler None </Location> </VirtualHost> You will need to change the urls after copying the project from the development directory to the directory where it will be placed to run in production. * adjust python paths in httpd-vhosts.conf * add extra template line in settings.py: "<templatesdir>/<project>", "<templatesdir>/<project>/<application>", * adjust the links in settings.py to the new directory * adjust links in the <templatesdir>/<project>/<application>/base.html * adjust links in other templates <templatesdir>/<project>/<application>/*.html For replacing, you can use a script (on win, via cygwin) #!/bin/bash for i in `ls` do sed -e s/project_media/media/g $i >> ./replaced_files/$i done Make sure the replaced_files directory exists before running the script 5. Admin site The admin site should work but you'll need to copy the media files over or make a link to the media files. The admin media files live here: C:\Python24\Lib\site-packages\django\contrib\admin\media Copy the dirs in the media directory under your own media directory: D:\sitesdjango\gema\media Test: http://gema/admin That's it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

