Project

General

Profile

Django-hosting » History » Revision 8

Revision 7 (Nico Schottelius, 04/08/2016 11:27 AM) → Revision 8/28 (Nico Schottelius, 04/08/2016 11:35 AM)

h1. django-hosting.ch by ungleich 

 h2. How to use 

 # h3. Configure your app 
 # Deploy your app 
 # 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 Create wsgi.py below your *app/wsgi.py* in your project root 

 h3. Database 

 Add that returns the following to your settings.py: 

 <pre> 
 DATABASES = { 
     'default': { 
         'ENGINE': 'django.db.backends.postgresql_psycopg2', 
         'NAME': 'app', 
     } 
 } 
 </pre> 


 wsgi application 



 h3. Deploy 

 * 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 


 * Use the database "app" (running on localhost, no password required) 
 ** Don't forget to run your migrations! 
 * Restart uwsgi to load the new code of your app 

 h3. 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) 
 **