[Fixed]-Cant install mod_wsgi in Django on Mac

1👍

If you are using MacOS X Sierra, then the problem is that Apple completely broke the ability to install third party Apache modules by no longer supplying certain command line tools required to do that.

Even so, in mod_wsgi 4.5.8 there is a workaround that allows pip install mod_wsgi to still work. This only works for the pip method of installation though and not the older style configure/make/make install method, which can’t find an easy workaround for.

Right at this instant in time 4.5.8 isn’t released though but will be in the next day or so. In the interim you can install from the GitHub repository by running:

pip install https://github.com/GrahamDumpleton/mod_wsgi/archive/develop.zip

As to the idea that there is no reason to install mod_wsgi for development, that is misleading. One of the main points of mod_wsgi-express is to make it very easy to use for development, including with Django. It is better to use mod_wsgi-express than the built in development server in some respects because you are then using a WSGI server which works in the same way as production would. This means you will pick up problems that relate to the final deployment method where as you wouldn’t when using just the Django development server. So it is better to also incorporate some use of mod_wsgi-express into development if mod_wsgi will be your final target. You can still get benefits of features such as automatic code reloading as mod_wsgi-express supports that, along with other features such as integrated Python debugger support etc.

The misconception about using mod_wsgi-express may come up because people think you have to do all this manual configuration to run it and thus it is too hard. You don’t. Running mod_wsgi-express is no different to running other WSGI servers that can be run from the command line in that mod_wsgi-express will handle all the configuration for you. So no manual configuration of Apache is required. It all happens automatically.

Until 4.5.8 is released and PyPi details are updated, the best place to see most up to date description of how to use mod_wsgi-express is at:

Leave a comment