[Django] #26383: Incomplete/incorrect documentation about using wsgi with Apache when project using virtualenv

4 views
Skip to first unread message

Django

unread,
Mar 20, 2016, 6:33:22 PM3/20/16
to django-...@googlegroups.com
#26383: Incomplete/incorrect documentation about using wsgi with Apache when
project using virtualenv
-------------------------------------+-------------------------------------
Reporter: zshimanchik | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 1.9
Severity: Normal | Keywords: wsgi, virtualenv,
| apache, documentation, modwsgi
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/
I've tryied to setup apache VirtualHost for my project with virtualenv,
using mod_wsgi in daemon mode. Project uses python2, but I think it
doesn't matter.
However following documentation I've tryied to use

{{{
WSGIDaemonProcess example.com python-
path=/path/to/mysite.com:/path/to/venv/lib/python2.7/site-packages
}}}

But this is not enough. besides python-path there must be set python-home
with path to virtualenv directory. here is example of my working
configuration:


{{{
<VirtualHost site1:80>
ServerName site1

WSGIDaemonProcess site1 python-
path=/home/neuron/projects/django_zs_testprj/zs_testprj:/home/neuron/projects/django_zs_testprj/env/lib/python2.7
/site-packages python-home=/home/neuron/projects/django_zs_testprj/env
WSGIProcessGroup site1
WSGIScriptAlias /
/home/neuron/projects/django_zs_testprj/zs_testprj/zs_testprj/wsgi.py

<Directory /home/neuron/projects/django_zs_testprj/zs_testprj/zs_testprj>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
}}}

Archlinux, Python 2.7.11, Apache/2.4.18, mod_wsgi2 4.4.22-1

--
Ticket URL: <https://code.djangoproject.com/ticket/26383>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 20, 2016, 6:51:45 PM3/20/16
to django-...@googlegroups.com
#26383: Incomplete/incorrect documentation about using wsgi with Apache when
project using virtualenv
-------------------------------------+-------------------------------------
Reporter: zshimanchik | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 1.9
Severity: Normal | Resolution:
Keywords: wsgi, virtualenv, | Triage Stage:
apache, documentation, modwsgi | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by zshimanchik):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

without using python-home I've got error:

{{{
[Mon Mar 21 00:52:48.171727 2016] [wsgi:error] [pid 11436:tid
140123186685696] [client 127.0.0.1:54200] mod_wsgi (pid=11436): Target
WSGI script
'/home/neuron/projects/django_zs_testprj/zs_testprj/zs_testprj/wsgi.py'
cannot be loaded as Python module.
[Mon Mar 21 00:52:48.171800 2016] [wsgi:error] [pid 11436:tid
140123186685696] [client 127.0.0.1:54200] mod_wsgi (pid=11436): Exception
occurred processing WSGI script
'/home/neuron/projects/django_zs_testprj/zs_testprj/zs_testprj/wsgi.py'.
[Mon Mar 21 00:52:48.171823 2016] [wsgi:error] [pid 11436:tid
140123186685696] [client 127.0.0.1:54200] Traceback (most recent call
last):
[Mon Mar 21 00:52:48.171849 2016] [wsgi:error] [pid 11436:tid
140123186685696] [client 127.0.0.1:54200] File
"/home/neuron/projects/django_zs_testprj/zs_testprj/zs_testprj/wsgi.py",
line 12, in <module>
[Mon Mar 21 00:52:48.171913 2016] [wsgi:error] [pid 11436:tid
140123186685696] [client 127.0.0.1:54200] from django.core.wsgi import
get_wsgi_application
[Mon Mar 21 00:52:48.171935 2016] [wsgi:error] [pid 11436:tid
140123186685696] [client 127.0.0.1:54200] ImportError: No module named
django.core.wsgi
}}}
note that I haven't installed django outside my virtualenv:
{{{
[neuron@eighteenth ~]$ python2 -c "import sys; print sys.path"
['', '/usr/lib/python2.7/site-packages/pyre-0.8_pathos-py2.7.egg',
'/usr/lib/python2.7/site-packages/pox-0.2.2-py2.7.egg',
'/usr/lib/python2.7/site-packages/dill-0.2.4-py2.7.egg',
'/usr/lib/python2.7/site-packages/pp-1.5.7_pathos-py2.7.egg',
'/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/gtk-2.0']
[neuron@eighteenth ~]$ python2 -c "import django; print django"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named django
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26383#comment:1>

Django

unread,
Mar 21, 2016, 4:00:32 AM3/21/16
to django-...@googlegroups.com
#26383: Incomplete/incorrect documentation about using wsgi with Apache when
project using virtualenv
-------------------------------------+-------------------------------------
Reporter: zshimanchik | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: 1.9
Severity: Normal | Resolution: needsinfo

Keywords: wsgi, virtualenv, | Triage Stage:
apache, documentation, modwsgi | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: new => closed
* resolution: => needsinfo


Comment:

I have several sites similarly installed and never had to use python-home.
We cannot change the documentation without having a deeper understanding
of what your problem was.

--
Ticket URL: <https://code.djangoproject.com/ticket/26383#comment:2>

Django

unread,
Mar 23, 2016, 1:34:54 PM3/23/16
to django-...@googlegroups.com
#26383: Incomplete/incorrect documentation about using wsgi with Apache when
project using virtualenv
-------------------------------------+-------------------------------------
Reporter: zshimanchik | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: 1.9
Severity: Normal | Resolution: invalid

Keywords: wsgi, virtualenv, | Triage Stage:
apache, documentation, modwsgi | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by zshimanchik):

* resolution: needsinfo => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/26383#comment:3>

Reply all
Reply to author
Forward
0 new messages