Configuring python in XAMPP
Using python 2.7.2 , mod_wsgi.so () for python 2.7.2.
Please make sure that you had already installed python and xampp in your local machine.
Steps to follow :-
———————–
1. Place the mod_wsgi from the location and rename it as mod_wsgi.so.
(depends on which apache version you are using)
2. Copy the mod_wsgi.so file to xampp/apache/modules.
3. Open httpd.conf file and load the module (\xampp\apache\conf\)
LoadModule wsgi_module modules/mod_wsgi.so
4. Copy your project in the xampp/htdocs.
5. Create a folder with name apache in it.
(project-name) /apache
6. Create a file with name django.wsgi and add the below code in it.
import os, sys
sys.path.append(‘c:/xampp/htdocs/(project-name) ‘)
sys.path.append(‘c:/xampp/htdocs/(project-name) ‘)
os.environ['DJANGO_SETTINGS_MODULE'] = ‘(project-name) .settings’
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
7. Open httpd-vhosts.conf file and add the below code in it.(xampp\apache\conf\extra)
Listen 81
<VirtualHost *:81>
ServerName XYZProject
ServerAlias XYZProject
WSGIScriptAlias / C:/xampp/htdocs/<Project Name>/apache/django.wsgi
<Directory C:/xampp/htdocs/<Project Name>/<sub-project-name>
Order allow,deny
Allow from all
</Directory>
<Directory C:/xampp/htdocs/<Project Name>/<Project Name>/media>
Order deny,allow
Allow from all
</Directory>
Alias /static/admin/ "D:/Python27/Lib/site-packages/django/contrib/admin/static/admin/"
<Directory "D:/Python27/Lib/site-packages/django/contrib/admin/static/admin/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
8. Finally restart the apache server and check it with http://localhost:81/(project-name)
No comments :
Post a Comment