简体   繁体   中英

using django with https using apache

I am using Apache 2.2.21 with mod_wsgi on a machine running arch linux. I want to use django with https ability. I have also installed python2.7 and python 3.2. The django.wsdi file of the project is given below. When I try to access a sample file with https but without using django it works fine. When I try to get a file from the django project using https I get the following error - ImportError: No module named django.core.handlers.wsgi

When I cd to /usr/lib/httpd/modules and do ldd mod_wsgi.so I get the following which shows that it is compiled against python 3.2. But django does not support python 3.2 only 2.7.

How can I work around this problem?

Appreciate any help/pointers.

$ldd mod_wsg.so
    linux-vdso.so.1 =>  (0x00007fff769e1000)
    libpython3.2mu.so.1.0 => /usr/lib/libpython3.2mu.so.1.0 (0x00007f82a3188000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f82a2f6b000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f82a2d66000)
    libutil.so.1 => /lib/libutil.so.1 (0x00007f82a2b63000)
    libm.so.6 => /lib/libm.so.6 (0x00007f82a28e1000)
    libc.so.6 => /lib/libc.so.6 (0x00007f82a2559000)
    /lib/ld-linux-x86-64.so.2 (0x00007f82a37e5000)

django.wsdi file: import os import sys

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

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

path = '/to/mysite'
if path not in sys.path:
    sys.path.append(path)

Install a version of mod_wsgi compiled against Python 2.7. The mod_wsgi module can only be bound to one Python version at a time and what is uses cannot be changed dynamically, instead only being able to be set at compile time.

If you actually want to use different Python versions at different times, you will not be able to use a single Apache/mod_wsgi instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM