On 5 June 2012 23:53, ivanb <[email protected]> wrote:
> 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
Run:
python manage.py shell
for Django application.
Then do:
import django
print dango.__path__
where is it actually finding it?
Does your user environment have PYTHONPATH set? That will not be read
by mod_wsgi.
Are all the directories/files accessible/readable to user that Apache runs as.
> 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
Overriding sys.stdout is not needed if using mod_wsgi 3.X, only older versions.
> 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.
>
--
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.