-
Make a symlink in
/srv
to the project directory (optional)sudo ln -s /mnt/Code/git_repos/owned/owliver /srv/owliver
-
Static file configuration must be correct. Here is an example:
STATIC_URL = '/static/' STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),) STATIC_ROOT = os.path.join(BASE_DIR,'staticfiles') MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR,'media')
-
Collect all static files
python3 manage.py collectstatic
-
Symlink
apache_conf.conf
into/etc/apache2/sites-available
sudo ln -s /srv/owliver/local_conf/apache_conf.conf /etc/apache2/sites-available/owliver.conf
-
If you haven't installed
mod_wsgi
, you can do so nowsudo apt-get install libapache2-mod-wsgi-py3
-
Edit
/etc/apache2/ports.conf
and add the lineListen 9000
(or whatever port number you are using in apache_conf.conf) belowListen 80
. You will require superuser access to edit the file. -
Enable your site
sudo a2ensite owliver.conf
-
Reload apache
sudo service apache2 reload
Last active
January 24, 2016 10:04
-
-
Save sharmaeklavya2/abbf2499c3d7b77079f0 to your computer and use it in GitHub Desktop.
Deploying a django project on Apache
This file contains 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
<VirtualHost *:9000> | |
WSGIDaemonProcess owliver.com python-path=/srv/owliver:/srv/owliver/myvenv3/lib/python3.4/site-packages | |
WSGIProcessGroup owliver.com | |
Alias /media/ /srv/owliver/media/ | |
Alias /static/ /srv/owliver/staticfiles/ | |
<Directory /srv/owliver/staticfiles> | |
Require all granted | |
</Directory> | |
<Directory /srv/owliver/media> | |
Require all granted | |
</Directory> | |
WSGIScriptAlias / /srv/owliver/project_conf/wsgi.py | |
<Directory /srv/owliver/project_conf> | |
<Files wsgi.py> | |
Require all granted | |
</Files> | |
</Directory> | |
</VirtualHost> |
This file contains 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
This file contains instructions on how to deploy a django project on Apache on Debian-based distributions. I have taken https://github.com/sharmaeklavya2/owliver as an example. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment