-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrun.py
More file actions
37 lines (34 loc) · 1.25 KB
/
run.py
File metadata and controls
37 lines (34 loc) · 1.25 KB
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
"""
Runs the Flask application 'APP' locally on port 8080.
Note: when running on pythonanywhere.com, this script is not used.
"""
from rvr.app import APP
# pylint:disable=W0611
from rvr.views import main # registers main pages @UnusedImport
from rvr.views import range_editor # @UnusedImport
from rvr.views import ajax # registers ajax functions @UnusedImport
from rvr.core.api import API
import logging
from rvr.mail.notifications import NOTIFICATION_SETTINGS
from rvr import local_settings
def _main():
"""
Does some initialisation, then runs the website.
"""
NOTIFICATION_SETTINGS.suppress_email = local_settings.SUPPRESS_EMAIL
# Initialise database
api = API()
api.create_db()
api.initialise_db()
api.ensure_open_games()
# Run the app locally
APP.run(host=APP.config.get('HOST', '0.0.0.0'),
port=APP.config.get('PORT', 80),
debug=APP.config['DEBUG'],
use_reloader=APP.config.get('RELOADER', False),
threaded=True) # https://stackoverflow.com/questions/17854713/error-errno-10053
if __name__ == '__main__':
logging.basicConfig(format="%(asctime)s: %(message)s",
datefmt='%Y-%m-%d %H:%M:%S')
logging.root.setLevel(logging.DEBUG)
_main()