Django-hosting » History » Revision 12
Revision 11 (Nico Schottelius, 04/08/2016 11:45 AM) → Revision 12/30 (Nico Schottelius, 04/08/2016 11:46 AM)
h1. django-hosting.ch by ungleich
{{toc}}
h2. 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!
h2. Configure your app
h3. WSGI
* Ensure that there is _projectname_/wsgi.py in your project root
h3. Database
Add the following to your settings.py:
<pre>
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'app',
}
}
</pre>
h2. Deploy
You can login to your VM as user *app* (for the django app) and *root* (in case you need to change settings):
<pre>
ssh app@MYHOSTNAME
</pre>
* 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
h2. 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*:
<pre>
. ~/pyvenv/bin/activate
pip install ...
</pre>
h2. Restarting the app
* *sudo systemctl restart uwsgi*
h3. 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*
h2. Description of the stack
h3. Technologies
* Debian 8
* nginx
* PostgreSQL
* uwsgi
h3. Configuration
* user "app"
** in group "adm" (to view logfiles)
* PostgreSQL with
** database "app"
** Listens only on localhost / socket (no remote connections)
**