Unable to deploy django project on windows server using mod_wsgi and wamp

Viewed 130

Instead of my django project running and showing my landing page. I'm only able to view my project files on localhost. The project runs fine on development when using python manage.py runserver but does not work with mod_wsgi and wamp.

in my wamp's apache httpd.conf file, I've added:

ServerName localhost:8000
Listen localhost:8000
Listen [::0]:80
.
.
Include "conf/extra/httpd-vhosts.conf"
.
.
# Django Project
LoadFile "c:/python3.6/python36.dll"
LoadModule wsgi_module "c:/python3.6/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "c:/python3.6"
WSGIPythonPath "C:/irfan/metatrader_api/mt5"

in my httpd-vhost.conf, I have :

#
WSGIPythonPath "C:/irfan/metatrader_api/mt5"

<VirtualHost *:8000>
    WSGIPassAuthorization On
    ErrorLog "logs/mt5.error.log"
    CustomLog "logs/mt5.access.log" combined
    DocumentRoot "c:/irfan/metatrader_api/mt5/mt5"
    WSGIScriptAlias /  "C:\irfan\metatrader_api\mt5\mt5\wsgi_windows.py"
    <Directory  "c:\irfan\metatrader_api\mt5\mt5">
        <Files wsgi_windows.py>
            Require all granted
        </Files>
    </Directory>
</VirtualHost>

WSGIApplicationGroup %{GLOBAL}

in wsgi_windows.py, I have

activate_this = "C:/irfan/irfan/Scripts/activate_this.py"
# execfile(activate_this, dict(__file__=activate_this))
exec(open(activate_this).read(),dict(__file__=activate_this))

import os
import sys
import site

# Add the site-packages of the chosen virtualenv to work with
site.addsitedir("C:/irfan/irfan/Lib/site-packages")[![enter image description here][1]][1]

# Add the app's directory to the PYTHONPATH
sys.path.append('C:/irfan/metatrader_api/mt5')
sys.path.append('C:/irfan/metatrader_api/mt5/mt5')

os.environ['DJANGO_SETTINGS_MODULE'] = 'mt5.settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mt5.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
0 Answers
Related