heisbuba commited on
Commit
8ba580e
·
verified ·
1 Parent(s): 9bad552

Create src/__init__.py

Browse files
Files changed (1) hide show
  1. src/__init__.py +33 -0
src/__init__.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from datetime import timedelta
3
+ from flask import Flask
4
+
5
+ # Import our configuration logic
6
+ from .config import init_firebase, FIREBASE_WEB_API_KEY
7
+
8
+ def create_app():
9
+ app = Flask(__name__)
10
+ app.secret_key = os.environ.get('FLASK_SECRET_KEY', os.urandom(24).hex())
11
+
12
+ # Cookie settings
13
+ app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=30)
14
+ app.config['SESSION_REFRESH_EACH_REQUEST'] = True
15
+ app.config['SESSION_COOKIE_SAMESITE'] = 'None'
16
+ app.config['SESSION_COOKIE_SECURE'] = True
17
+
18
+ # Initialize Database
19
+ try:
20
+ init_firebase()
21
+ except Exception as e:
22
+ print(f"❌ FATAL: {e}")
23
+
24
+ # Register Blueprints
25
+ from .blueprints.auth import auth_bp
26
+ from .blueprints.main import main_bp
27
+ from .blueprints.tasks import tasks_bp
28
+
29
+ app.register_blueprint(auth_bp)
30
+ app.register_blueprint(main_bp)
31
+ app.register_blueprint(tasks_bp)
32
+
33
+ return app