Last active
January 3, 2016 00:39
-
-
Save alazyer/8384344 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. create a mysite.conf file in the /etc/apache2/sites-available directory. Fill it with | |
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so | |
# configure the wsgi script | |
WSGIScriptAlias / wsgi.py | |
WSGIPythonHome virtualenv dir | |
WSGIPythonPath project_root: site-packages_dir_in_the_virtualenv | |
<VirtualHost *:8000> | |
ServerName 127.0.0.1 | |
DocumentRoot project_root | |
<Directory main_application_dir> | |
<Files wsgi.py> | |
Order Deny,Allow | |
Allow from all | |
</Files> | |
</Directory> | |
Alias /static/ settings.STATIC_ROOT | |
<Directory settings.STATIC_ROOT> | |
Order Deny,Allow | |
Allow from all | |
</Directory> | |
Alias /media/ settings.MEDIA_ROOT | |
<Directory settings.MEDIA_ROOT> | |
Order Deny,Allow | |
Allow from all | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/error_PROJECT.log | |
CustomLog ${APACHE_LOG_DIR}/access_PROJECT.log combined | |
</VirtualHost> | |
2. include this file in the apache2.conf by "Include httpd.conf", | |
or in the sites-enbaled link to this file. | |
3. adding ports info in the /etc/apache2/ports.conf | |
NameVirtualHost *:8000 | |
Listen 8000 | |
4. configure the wsgi.py in the main_application_dir, add the following content | |
import sys | |
import site | |
site.addsitedir(site-package_dir_in_virtualenv) | |
sys.path.append(project_root_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment