I'm putting my django site in production for the first time so please
forgive for my ignorance.

I'm trying to put my django site on apache. I've read documentation
about mod_wsgi and tried that simple Hello world so it is configured
OK. The problem I'm having seems to be with using virtualenvs with it.
I wanna set things up properly including virtualenvs and everything so
I'm ready for future sites.

To the problem now.

The error I'm getting in apache log is:

    No module named django.core.handlers.wsgi

So it seems that it is not reading my virtualenvs properly.

This is my wsgi script:
    import os
    import sys
    import site
    site.addsitedir('/home/user/.virtualenvs/myapp/lib/python2.7/site-
packages')

    path = '/home/user/django/myapp/myapp'
    if path not in sys.path:
        sys.path.append(path)

    sys.stdout = sys.stderr
    print sys.path

    os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'

    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()

And this is the error log from apache. I printed out the sys.path so
you can see what it looks like.

    [Tue Jun 05 14:54:07 2012] [error] ['/usr/lib/python27.zip', '/usr/
lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/
lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-
dynload', '/usr/lib/python2.7/site-packages', '/usr/lib/python2.7/site-
packages/PIL', '/usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-
info', '/home/user/.virtualenvs/myapp/lib/python2.7/site-packages', '/
home/user/django/myapp/myapp']
    [Tue Jun 05 14:54:07 2012] [error] [client 127.0.0.1] mod_wsgi
(pid=1039): Target WSGI script '/srv/http/wsgi_scripts/myapp.wsgi'
cannot be loaded as Python module.
    [Tue Jun 05 14:54:07 2012] [error] [client 127.0.0.1] mod_wsgi
(pid=1039): Exception occurred processing WSGI script '/srv/http/
wsgi_scripts/myapp.wsgi'.
    [Tue Jun 05 14:54:07 2012] [error] [client 127.0.0.1] Traceback
(most recent call last):
    [Tue Jun 05 14:54:07 2012] [error] [client 127.0.0.1]   File "/srv/
http/wsgi_scripts/myapp.wsgi", line 17, in <module>
    [Tue Jun 05 14:54:07 2012] [error] [client 127.0.0.1]     import
django.core.handlers.wsgi
    [Tue Jun 05 14:54:07 2012] [error] [client 127.0.0.1] ImportError:
No module named django.core.handlers.wsgi

If you have any suggestions or already had similar issue please help.

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 at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to