Install mod_wsgi on Ubuntu with Python 3.6, Apache 2.4, and Django 1.11

风流意气都作罢 提交于 2019-11-28 19:17:07
Graham Dumpleton

Do the following.

Uninstall your system mod_wsgi package.

sudo apt-get remove libapache2-mod-wsgi-py3

Install mod_wsgi using pip, preferably into a Python virtual environment. Ensure pip is for the version of Python you want to use.

pip install mod_wsgi

Display the config to add to Apache configuration file to load this mod_wsgi by running:

mod_wsgi-express module-config

Take the output of above command to display config and add to Apache configuration.

Add configuration to Apache to load a hello world WSGI application to test it works.

See details for pip based install in:

When I have used the @Graham Dumpleton suggestion to install the mod_wsgi using pip, got this error:

RuntimeError: The 'apxs' command appears not to be installed or is not executable.
Please check the list of prerequisites in the documentation for this package and
install any missing Apache httpd server packages.

To successfully compile and install the mod_wsgi through pip, I need to install the apache2-dev package on Ubuntu:

sudo apt-get install -y apache2-dev

After that pip install mod_wsgi completes successfully.

Hope that might help others.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!