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