LoadModule wsgi_module modules/mod_wsgi.so for Apache with Django

13,648

Try,

LoadModule wsgi_module modules/mod_wsgi.so
DirectoryIndex  index.py default.py wsgi.py
WSGIPythonPath "{$path}\python\Lib;{$path}\python\Lib\site-packages;{$path}\python\DLLs"
WSGIPythonHome "{$path}\python"
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

Let {$path} be the directory where Python Folder is installed/located. Notice the change in WSGIPythonPath and WSGIPythonHome.

You can search for pre-compiled binaries from here: https://github.com/GrahamDumpleton/mod_wsgi/tree/master/win32#using-the-pre-compiled-binaries

Also mowd_wsgi's Quick Configuration Guide is helpful.

Share:
13,648
paarth batra
Author by

paarth batra

Updated on June 04, 2022

Comments

  • paarth batra
    paarth batra almost 2 years

    I want to run django site with apache mod_wsgi , but as per django documentation whenever i write following in httpd.conf file :

    WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
    WSGIPythonPath /path/to/mysite.com
    
    <Directory /path/to/mysite.com/mysite>
    <Files wsgi.py>
    Require all granted
    </Files>
    </Directory>
    

    Apache server fails to start , Issue was that mod_wsgi module was not present in apache24 modules directory and due to it following line was causing issue

    LoadModule wsgi_module modules/mod_wsgi.so 
    

    I am trying to get this mod_wsgi.so file but i could find it anywhere . I downloaded mod_wsgi-4.4.12.tar.gz from below url but there also i cant get mod_wsgi.so file .

    https://github.com/GrahamDumpleton/mod_wsgi

    I tried getting it from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi but here files are with extension .whl

    at one link its written that we can build our own mod_wsgi.so with help of nmake command nmake -f apXYpyXY-winNN-VC?.mk but in windows i get error nmake is not recogiznised as a command .

    Please suggest . I am using Windows 7 , Python 2.7 , 64 bit , Apache 2.4 64 bit and Apache 2.2 32 bit .