I ran the following commands

sudo apt-get install libapache2-mod-wsgi
sudo a2enmod mod-wsgi

I keep getting this extremely frustrating message

ERROR: Module mod-wsgi does not exist!

Please help.

  • 1
    sudo a2enmod will give you list of modules installed. Just enable wsgi as said by ajmitch – sagarchalise Feb 9 '11 at 5:20

Using sudo a2enmod wsgi should enable the module for you once you reload apache, as most modules don't need the mod_ prefix when enabling them.

  • i tried sudo a2enmod wsgi but even I m still getting the same error. I typed sudo a2enmod and these are the choices I got dpaste.de/NEIcf It does not contain wsgi. Is it ok to ask this question here or do I need to post a new question? – Sam007 Aug 21 '12 at 17:22
sudo nano /etc/apache2/mods-available/wsgi.load

add the next string to the file

LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

save, then

sudo a2enmod wsgi
sudo service apache2 restart
  • And how to test this? – Sören Nov 20 '18 at 23:52
  • not sure there is some test_mode_wsgi script.. just point apache to your wsgi application (check the docs of your framework how to do it), and check if it works.. – Valentin Kantor Nov 21 '18 at 18:18

Step 1: The following command will install wgsi module

sudo apt-get install libapache2-mod-wsgi

Step 2: To enable the wsgi module run the following command

sudo a2enmod wsgi

Step 3: Restart your apache server by running

sudo systemctl restart apache2

Step 4: Check whether the module is loaded

sudo apache2ctl -t -D DUMP_MODULES   

P.S: I am using Ubuntu 18.04 LTS

  • 1
    Use sudo for apache2ctl -t -D DUMP_MODULES – KalenGi Mar 15 at 9:28

Try adding the wsgi.load and wsgi.conf from mods-available to mods-enabled manually and then restart Apache.


WSGI Warning

Official WSGI documentation says:

When using a Python virtual environment with mod_wsgi, it is very important that it has been created using the same Python installation that mod_wsgi was originally compiled for.

And then:

It is not possible to use a Python virtual environment to force mod_wsgi to use a different Python version, or even a different Python installation. In other words, Python interpreter is embedded within the mod_wsgi.

So I would not recommend any of precompiled mod_wsgi binaries from apt but instead you can compile it following the official installation docs.

The other way

Use https://gunicorn.org/ and an Apache's

ProxyPass / http://localhost:8000/

directive in your virtualhost config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.