ho and by the way, mod_python does not seem to be installed on this server, anyway a2dismod does not list it.
On Nov 3, 1:02 am, karme <[email protected]> wrote: > Ok I thought I would try again from scratch using specific > instructions but you're right let's start from an actual config and > work our way from there. > > So I will start with what seems to be the closest configuration to > what I actually want to achieve: > > 1. The actual Apache configuration snippets for mod_wsgi you are > using: > > <VirtualHost someserver:80> > ServerName myvirtualhost > > DocumentRoot /path/to/my/project/apache/documents > > <Directory /path/to/my/project/apache/documents> > Order allow,deny > Allow from all > </Directory> > > # I comment this line so the server starts in embedded mode and I > get the errors in Apache error.log > # (I can't see any error in daemon mode) > #WSGIDaemonProcess django processes=2 threads=5 display- > name=myproject user=myuser group=mygroup > WSGIScriptAlias / /path/to/my/project/apache/settings.wsgi > > <Directory /path/to/my/project/apache> > #WSGIProcessGroup django > Order allow,deny > Allow from all > </Directory> > </VirtualHost> > > 2. The contents of your WSGI script file: > > import os > import sys > > root = os.path.join(os.path.dirname(__file__), '..') > sys.path.insert(0, root) > > activate_this = os.path.join(root, 'bin/activate_this.py') > execfile(activate_this, dict(__file__=activate_this)) > > os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' > > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() > > 3. Indicate how you created the virtual environment, did you use > --no-site-packages option to virtualenv. > > Yes I used --no-site-packages > > 4. The actual error messages from the Apache error logs you are > getting showing there is a problem. > > With this config, the apache error log gives this output: > > [Wed Nov 02 21:27:14 2011] [info] mod_wsgi (pid=4658): Create > interpreter 'myproject.myhost|'. > [Wed Nov 02 21:27:14 2011] [info] [client IP] mod_wsgi (pid=4658, > process='', application='myproject.myhost|'): Loading WSGI script '/ > path/to/my/project/apache/settings.wsgi'. > [Wed Nov 02 21:27:14 2011] [error] [client IP] mod_wsgi (pid=4658): > Target WSGI script '/path/to/my/project/apache/settings.wsgi' cannot > be loaded as Python module. > [Wed Nov 02 21:27:14 2011] [error] [client IP] mod_wsgi (pid=4658): > Exception occurred processing WSGI script '/path/to/my/project/apache/ > settings.wsgi'. > [Wed Nov 02 21:27:14 2011] [error] [client IP] Traceback (most recent > call last): > [Wed Nov 02 21:27:14 2011] [error] [client IP] File "/path/to/my/ > project/apache/settings.wsgi", line 12, in <module> > [Wed Nov 02 21:27:14 2011] [error] [client IP] import > django.core.handlers.wsgi > [Wed Nov 02 21:27:14 2011] [error] [client IP] ImportError: No module > named django.core.handlers.wsgi > [Wed Nov 02 21:27:14 2011] [debug] mod_deflate.c(615): [client IP] > Zlib: Compressed 538 to 325 : URL / > [Wed Nov 02 21:27:14 2011] [info] mod_wsgi (pid=4663): Initializing > Python. > [Wed Nov 02 21:27:14 2011] [info] mod_wsgi (pid=4663): Attach > interpreter ''. > > Another interesting thing to note is that on my local system I can > source bin/activate and start python and load django but on the Debian > with Apache and mod_wsgi I have just tried the same and cannot load > django. Before trying this method I tried some of the other methods > described in the video "Getting started with Apache/mod_wsgi" at Pycon > Australia and I could successfully load django. I don't know what went > wrong then. > > Any idea? > Thanks > > On Nov 3, 12:27 am, Graham Dumpleton <[email protected]> > wrote: > > > > > > > > > Did you disable mod_python from Apache? > > > Also please start by providing the following: > > > 1. The actual Apache configuration snippets for mod_wsgi you are using. > > 2. The contents of your WSGI script file. > > 3. Indicate how you created the virtual environment, did you use > > --no-site-packages option to virtualenv. > > 4. The actual error messages from the Apache error logs you are > > getting showing there is a problem. > > > You can also check you are actually running in daemon mode by following: > > >http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Embedd... > > > Anyway, at the moment you are saying it doesn't work but not actually > > saying what is failing. There is going to be no point referring you to > > the same documentation you have likely already read, so lets address > > the specific error or wrong behaviour you are getting instead. > > > Graham > > > On 3 November 2011 06:40, karme <[email protected]> wrote: > > > > Hi, > > > > I have read the docs and watched the videos but yet cannot make it > > > work. > > > I have tried the various options and at times almost got it working. > > > > Now I'd like your help. > > > > - What I have: a standard Debian squeeze with Apache2, python and > > > mod_wsgi installed via apt-get. > > > - What I want: being able to run Django with mod_wsgi in daemon mode > > > using what's inside my project directory only, using virtualenv, I > > > don't even have django installed in the system. > > > - What is working: the daemon mode seems to be working since I set it > > > up to run with my user and I see it like that in top / ps while > > > accessing the virtual host which is running the hello world wsgi > > > program succesfully. > > > > Now I tried to run Django with different method found in the various > > > docs to no avail. I'm trying again from scratch. Could you please tell > > > me what is the preferred way to achieve the aforementioned goal so I > > > can try again? Or may be tell me if my current setup is wrong? Please > > > provide some code or even just some references to the docs. If more > > > info is needed I can provide it. > > > Any help would be much appreciated. Last time I deployed a Django app > > > was with mod_python and I can't remember having such troubles, is it > > > me or mod_wsgi is a bit more complicated to handle? > > > Thanks. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "modwsgi" 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 > > > athttp://groups.google.com/group/modwsgi?hl=en. -- You received this message because you are subscribed to the Google Groups "modwsgi" 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/modwsgi?hl=en.
