Z
Z
zkweb2015-08-05 13:07:32
Django
zkweb, 2015-08-05 13:07:32

MOD_WSGI where to set the path to Python 2.7?

There are two versions of python in the system. 2.6 and 2.7
2.6 is needed because the old project is running on it.
I also installed 2.7 in a virtual environment.
Specified in the settings:

WSGIDaemonProcess test2 processes=2 maximum-requests=5 threads=1 python-path=/home/adminko/projects/test2 :/home/adminko/.virtualenvs/test2 /lib/python2.7/site-packages

But I have a 500 error.
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68] mod_wsgi (pid=10634): Target WSGI script '/home/adminko/projects/test2/test2/wsgi.py' cannot be loaded as Python module.
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68] mod_wsgi (pid=10634): Exception occurred processing WSGI script '/home/adminko/projects/test2/test2/wsgi.py'.
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68] Traceback (most recent call last):
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]   File "/home/adminko/projects/test2/test2/wsgi.py", line 12, in <module>
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]     from django.core.wsgi import get_wsgi_application
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]   File "/home/adminko/.virtualenvs/test2/lib/python2.7/site-packages/django/__init__.py", line 1, in <module>
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]     from django.utils.version import get_version
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]   File "/home/adminko/.virtualenvs/test2/lib/python2.7/site-packages/django/utils/version.py", line 7, in <module>
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]     from django.utils.lru_cache import lru_cache
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]   File "/home/adminko/.virtualenvs/test2/lib/python2.7/site-packages/django/utils/lru_cache.py", line 28
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]      fasttypes = {int, str, frozenset, type(None)},
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]                      ^
[Wed Aug 05 11:11:47 2015] [error] [client 172.20.1.68]  SyntaxError: invalid syntax

wsgi file
#!/usr/bin/python2.7
#coding: utf-8

import os
import sys

PROJECT_ROOT = os.path.dirname(__file__)
PYTHON_LIBS = '/home/adminko/.virtualenvs/test2/lib/python2.7/site-packages'
sys.path.append('/home/adminko/projects/test2')

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

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

I understand apache refers to 2.6, but I need 2.7
How can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2015-08-05
@deliro

Install nginx + uWSGI.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question