Actions
Django-hosting » History » Revision 12
« Previous |
Revision 12/30
(diff)
| Next »
Nico Schottelius, 04/08/2016 11:46 AM
django-hosting.ch by ungleich¶
- Table of contents
- django-hosting.ch by ungleich
How to use¶
- Configure your app
- Deploy your app
- Install python requirements into the pyvenv
- Restart uwsgi to restart your app
- Go to http://your-hostname/ and enjoy!
Configure your app¶
WSGI¶
- Ensure that there is projectname/wsgi.py in your project root
Database¶
Add the following to your settings.py:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'app', } }
Deploy¶
You can login to your VM as user app (for the django app) and root (in case you need to change settings):
ssh app@MYHOSTNAME
- Deploy / update your app into the folder ~app/app (that is the app folder in the home of the user app)
- We recommended to use git to deploy it
Install python requirements into the pyvenv¶
Pyvenv has been installed and you need to use pyvenv found in ~/pyvenv, as uwsgi loads this pyvenv before loading your app.
. ~/pyvenv/bin/activate pip install ...
Restarting the app¶
- sudo systemctl restart uwsgi
Viewing logfiles¶
- nginx access log: tail -F /var/log/nginx/access.log
- nginx error log: tail -F /var/log/nginx/error.log
- uwsgi log: tail -F /var/log/uwsgi/app/app.log
Description of the stack¶
Technologies¶
- Debian 8
- nginx
- PostgreSQL
- uwsgi
Configuration¶
- user "app"
- in group "adm" (to view logfiles)
- PostgreSQL with
- database "app"
- Listens only on localhost / socket (no remote connections) **
Updated by Nico Schottelius over 8 years ago · 12 revisions