forked from flathunters/flathunter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (25 loc) · 1.05 KB
/
main.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
""" Startup file for Google Cloud deployment or local webserver"""
from flathunter.idmaintainer import IdMaintainer
from flathunter.googlecloud_idmaintainer import GoogleCloudIdMaintainer
from flathunter.web_hunter import WebHunter
from flathunter.config import Config
from flathunter.web import app
config = Config()
if __name__ == '__main__':
# Use the SQLite DB file if we are running locally
id_watch = IdMaintainer('%s/processed_ids.db' % config.database_location())
else:
# Use Google Cloud DB if we run on the cloud
id_watch = GoogleCloudIdMaintainer()
hunter = WebHunter(config, id_watch)
app.config["HUNTER"] = hunter
if 'website' in config:
app.secret_key = config['website']['session_key']
app.config["DOMAIN"] = config['website']['domain']
app.config["BOT_NAME"] = config['website']['bot_name']
else:
app.secret_key = b'Not a secret'
app.config["BOT_TOKEN"] = config['telegram']['bot_token']
if __name__ == '__main__':
listen = config['website']['listen']
app.run(host=listen['host'], port=listen['port'], debug=True)