How can I rebuild my mod_wsgi to use python 2.7.3?

我与影子孤独终老i 提交于 2019-12-04 04:02:58

You have to compile mod_wsgi from source and reinstall.

Most likely as simple as:

$ ./configure
$ make
$ sudo make install

The mod_wsgi documentation covers this in detail.

I didn't have to compile from source, this helped me:

$ apt-get remove libapache2-mod-python libapache2-mod-wsgi 
$ apt-get build-dep libapache2-mod-python libapache2-mod-wsgi 

Remember to check that the files wsgi.load and wsgi.conf are still referenced in the apache2 configuring. For Ubuntu (and probably Debian) that means having a symbolic link from /etc/apache2/mods-available to /etc/apache2/mods-enabled.

Had the same problem, solved by suing virtual environments.

For set up: https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps Just followed the same steps, set up a virtualenv in the same folder as my django app.

Ended up with the following virtual host configuration:

<Directory /storage/sandbox/www/django/sampleapp/static>
    Allow from all
    Order deny,allow
</Directory>
<Directory /storage/sandbox/www/django/sampleapp/media>
    Allow from all
    Order deny,allow
</Directory>
WSGIScriptAlias / /storage/sandbox/www/django/sampleapp/sampleapp/wsgi.py
WSGIPythonPath /storage/sandbox/www/django/sampleapp/:/storage/sandbox/www/django/env/lib/python2.7/site-packages
<Directory /storage/sandbox/www/django/sampleapp/sampleapp>
    <Files wsgi.py>
        Allow from all
        Order deny,allow
    </Files>
</Directory>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!