-
Notifications
You must be signed in to change notification settings - Fork 21
/
app.py
63 lines (39 loc) · 1.45 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""
Configuration for deploying pyvo.cz on the rosti.cz hosting.
It should be easy to adapt to other kinds of WSGI-based hosting.
Instructions:
- Put this repo in /srv/app. You'll need to clear the previous contents:
rm -rf /srv/app
git clone https://github.com/pyvec/pyvo.cz /srv/app
- Clone the data directory here:
git clone https://github.com/pyvec/pyvo-data /srv/app/pyvo-data
- Make a password file for the Github hook:
echo YOUR_RANDOM_PASSWORD > pull_password
(This is not too secure; it's just to avoid DoS from anyone having access
to the DB reload functionality)
- Install everything:
pip install -r requirements.txt
- Deploy:
supervisorctl restart app
- Configure the Github hook for pyvec/pyvo-data to
POST to pyvo.cz/api/reload_hook?password=YOUR_RANDOM_PASSWORD
- If automated tweets of events are desired, set up pyvo-twitter according to
https://github.com/pyvec/pyvo-twitter.
"""
import logging
from pyvocz.app import create_app
logging.basicConfig(level=logging.INFO)
db = 'sqlite:////srv/app/db.sqlite'
datadir = 'pyvo-data'
host = 'pyvo.cz'
port = 80
try:
password_file = open('pull_password')
except FileNotFoundError:
pull_password = None
else:
with password_file:
pull_password = password_file.read().strip()
application = create_app(datadir=datadir, echo=False,
pull_password=pull_password,
host=host, port=port)