Repository navigation
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·43 lines (38 loc) · 1.5 KB
/
Copy pathrun.py
File metadata and controls
executable file
·43 lines (38 loc) · 1.5 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
38
39
40
41
42
43
from app import app
from app.models import Base, engine
from app.db_queries import init_db, sync_version_to_db, ensure_reminder_permissions, ensure_edition_settings, ensure_list_type_edition_column
from app.translation import load_translation_in_cache, migrateTranslations
from app.logger import log
from app.version import __version__
# Database initialization
Base.metadata.create_all(engine)
init_db()
sync_version_to_db()
ensure_reminder_permissions()
ensure_edition_settings()
ensure_list_type_edition_column()
migrateTranslations(overwrite=True)
load_translation_in_cache()
# VAPID key generation (for push notifications)
from app.notifications import _ensure_vapid_keys
_ensure_vapid_keys()
# v1 → v2 Migration (runs in background thread so the server can serve
# the migration-progress page while the migration is running)
try:
from app.migration import check_and_run_migration
from app.migration.v1_reader import v1_configured
if v1_configured():
import threading
threading.Thread(target=check_and_run_migration, daemon=True).start()
except ImportError:
pass
# Start scheduler
from app.scheduler import start_scheduler
start_scheduler(app)
if __name__ == '__main__':
import os
debug = os.environ.get('FLASK_DEBUG', 'false').lower() == 'true'
port = int(os.environ.get('PORT', 5001))
log('info', f'SharedMoments {__version__}')
log('info', f'Starting the application on port {port} (debug={debug})')
app.run(debug=debug, host='0.0.0.0', port=port, threaded=True)