Z
Z
zkweb2015-08-07 12:53:05
Django
zkweb, 2015-08-07 12:53:05

Why doesn't Apache run the right version of Python?

Hello!
I have two versions of python 2.6 and 2.7. Old Django project running 2.6 + django 1.3
Virtualenvs installed. Just the old site works in it + installed the environment there only by specifying the version of python 2.7
+ activated it.
HAVE MADE THESE SETTINGS:

NameVirtualHost *:82
Listen 82
<VirtualHost *:82>
    ServerAdmin [email protected]
    ServerName localhost

    DocumentRoot /var/www

    LogLevel warn
    ErrorLog /home/adminko/projects/test/error_log

    WSGIDaemonProcess test processes=2 maximum-requests=500 threads=1
    WSGIProcessGroup test

    WSGIScriptAlias / /home/adminko/projects/test/django.wsgi

    Alias /media/ /home/adminko/projects/test/media/
    Alias /admin-media/ /home/adminko/.virtualenvs/test/lib/python2.7/site-packages/django/contrib/admin/media/

    <Directory /home/adminko/projects/test/media>
        Order deny,allow
        Allow from all
    </Directory>
    <Directory /home/adminko/.virtualenvs/test/lib/python2.7/site-packages/django/contrib/admin/media>
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

DJANGO.WSGI
import os
import sys

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

sys.path.extend((PROJECT_ROOT,PYTHON_LIBS,os.path.dirname(PROJECT_ROOT)))

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

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

SUMMARY: My site is running with Django 1.3 + Python 2.6
In settings.py, I deleted the lines
MIDDLEWARE_CLASSES = (
) to see what was going on, just an error 500 was always
d481e7e805444faf99787881b0dd1240.JPG
Help, please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
anelyubin, 2015-08-07
@anelyubin

Of course, I apologize for the "stupid" question, but why use all these shamanic dances with tambourines, with virtual environments and version managers if virtual machines have long been invented? You create an ideally clean environment for yourself in a virtual machine with the necessary versions of all software and enjoy life. Or is there something I don't know?

M
Maxim Vasiliev, 2015-08-08
@qmax

mod_wsgi runs the python (libpython) it was built with.
the link to the library is fixed directly in .so and nothing can be done about it.
you can try to build two versions of mod_wsgi and somehow play shaman with directives.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question