Created
March 30, 2018 20:25
-
-
Save nspo/715968bbbca473d674ecc78e40d8cb46 to your computer and use it in GitHub Desktop.
Running multiple Django projects on one Apache instance with mod_wsgi
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
STATIC_URL = '/site1/static/' | |
# adjust name of session id | |
SESSION_COOKIE_NAME = "site1" |
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
STATIC_URL = '/site2/static/' | |
# adjust name of session id | |
SESSION_COOKIE_NAME = "site2" |
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
# /etc/apache2/sites-available/site1-site2.conf | |
WSGIDaemonProcess site1 python-home=/var/www/site1 python-path=/var/www/site1 | |
WSGIProcessGroup site1 | |
WSGIDaemonProcess site2 python-home=/var/www/site2 python-path=/var/www/site2 | |
WSGIProcessGroup site2 | |
# works with SSL too | |
<VirtualHost *:80> | |
Alias /site1/static/ /var/www/site1/myapp/static/ | |
<Directory /site1/static> | |
Require all granted | |
</Directory> | |
WSGIScriptAlias /site1 /var/www/site1/myproj/wsgi.py process-group=site1 | |
<Directory /var/www/site1/myproj> | |
<Files wsgi.py> | |
Require all granted | |
</Files> | |
</Directory> | |
Alias /site2/static/ /var/www/site2/myapp/static/ | |
<Directory /site2/static> | |
Require all granted | |
</Directory> | |
WSGIScriptAlias /site2 /var/www/site2/myproj/wsgi.py process-group=site2 | |
<Directory /var/www/site2/myproj> | |
<Files wsgi.py> | |
Require all granted | |
</Files> | |
</Directory> | |
</VirtualHost> |
how to set domain name in this setting??
You should be able to specify a ServerName
directive inside the <VirtualHost> ... </VirtualHost>
section. See here: https://httpd.apache.org/docs/2.4/vhosts/examples.html
thank you bro this helped me a lot ๐๐.
Very good, very helpful! Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to set domain name in this setting??