$ django-admin startproject mysite
$ cd mysite
$ python manage.py runserver
$ python manage.py startapp polls
$ python manage.py migrate
$ python manage.py makemigrations polls
$ python manage.py sqlmigrate polls 0001
$ python manage.py migrate
$ python manage.py createsuperuser
-
Set enviornment varialble
MOD_WSGI_APACHE_ROOTDIR = D:\xampp\apache
-
Install visual c++ build tools if not installed Visual C++ 2015 Build Tools
-
$ pip install mod_wsgi
-
Update LIBEXECDIR in C:\Users\usre\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\mod_wsgi\server\apxs_config.py
LIBEXECDIR = 'D:/xampp/apache/lib'
-
Update apache httpd.conf with the following according to you project
DocumentRoot "D:/xampp/htdocs"
<Directory "D:/xampp/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.php index.pl index.py index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>
<Directory "D:/xampp/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
LoadModule wsgi_module "c:/users/usre/appdata/local/programs/python/python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd"`
<IfModule wsgi_module>
LoadFile "c:/users/usre/appdata/local/programs/python/python36-32/python36.dll"
WSGIPythonHome "c:/users/usre/appdata/local/programs/python/python36-32"
WSGIScriptAlias /python/mysite D:/xampp/htdocs/python/mysite/mysite/wsgi.py
WSGIScriptReloading On
</IfModule>
<Directory "D:/xampp/htdocs/python/mysite/mysite">
AddHandler wsgi-script .wsgi .py
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
- Open http://localhost/python/mysite/ from browser
- Coming soon
Update mysite/setting.py
STATIC_URL = '/python/mysite/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
$ python manage.py collectstatic
python -c "import django; print(django.__path__)"