Project

General

Profile

Django-hosting » History » Version 9

Nico Schottelius, 04/08/2016 11:36 AM

1 1 Nico Schottelius
h1. django-hosting.ch by ungleich
2
3 9 Nico Schottelius
{{toc}}
4
5 1 Nico Schottelius
h2. How to use
6
7 8 Nico Schottelius
# Configure your app
8
# Deploy your app
9
# Restart uwsgi to restart your app
10
# Go to http://your-hostname/ and enjoy!
11 1 Nico Schottelius
12
13 8 Nico Schottelius
h2. Configure your app
14
15
h3. WSGI
16
17
* Ensure that there is _projectname_/wsgi.py in your project root
18
19
h3. Database
20
21
Add the following to your settings.py:
22
23
<pre>
24
DATABASES = {
25
    'default': {
26
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
27
        'NAME': 'app',
28
    }
29
}
30
</pre>
31 4 Nico Schottelius
32
33
h3. Deploy
34
35 2 Nico Schottelius
* Deploy / update your app into the folder *~app/app* (that is the app folder in the home of the user app)
36
** We recommended to use git to deploy it
37 4 Nico Schottelius
38
39 1 Nico Schottelius
* Use the database "app" (running on localhost, no password required)
40 5 Nico Schottelius
** Don't forget to run your migrations!
41 2 Nico Schottelius
* Restart uwsgi to load the new code of your app
42 3 Nico Schottelius
43 2 Nico Schottelius
h3. Restarting the app
44
45
* *sudo systemctl restart uwsgi*
46
47
48
h3. Viewing logfiles
49 1 Nico Schottelius
50 4 Nico Schottelius
* nginx access log: *tail -F /var/log/nginx/access.log*
51
* nginx error log: *tail -F /var/log/nginx/error.log*
52 7 Nico Schottelius
* uwsgi log: *tail -F /var/log/uwsgi/app/app.log*
53 6 Nico Schottelius
54 4 Nico Schottelius
55 1 Nico Schottelius
56
57
h2. Description of the stack
58
59
h3. Technologies
60
61
* Debian 8
62
* nginx
63
* PostgreSQL
64
* uwsgi
65 3 Nico Schottelius
66
h3. Configuration
67
68
* user "app"
69
** in group "adm" (to view logfiles)
70
* PostgreSQL with
71
** database "app"
72
** Listens only on localhost / socket (no remote connections)
73
**