Deploy Django on xampp server

By ukmodak | August 12th 2022 07:07:45 PM | viewed 220 times
step 1:

Set environment variavle on windows as

MOD_WSGI_APACHE_ROOTDIR = C:\xampp\apache
step 2: open terminal and run following command
pip install mod_wsgi=4.5.20
step 3: to get mod_wsgi path , open terminal and run following command and copy the path
mod_wsgi-express module-config
step 4: open this file http.conf and write the following code C:\xampp\apache\http.conf or on wamp :wamp64\bin\apache\apache2.4.39\conf
loadModule wsgi_module "path"
WSGIScriptAlias / "d:/dijango_project_location/demo/demo/wsgi.py"
WSGIPythonHome "c:/python36"
WSGIPythonPath "d:/dijango_project_location/demo/"

Alias /media/ d:/dijango_project_location/demo/media
Alias /media/ d:/dijango_project_location/demo/static

<Directory d:/dijango_project_location/demo/media>
   Require all granted
</Directory>

<Directory d:/dijango_project_location/demo/static>
   Require all granted
</Directory>

<Directory "d:/dijango_project_location/demo">
   <Files wsgi.py>
      Require all granted
   </Files>
</Directory>

step 5: if apper 400 error on localhost, then to go django project /setting.py and change the following line>
DEBUG = True
ALLOWED_HOSTS =['127.0.0.1','localhost']
DEBUG = False
bONEandALL
Visitor

Total : 18980

Today :9

Today Visit Country :

  • Germany
  • Singapore
  • United States
  • Russia