Skip to content

Commit 0a86f29

Browse files
Updated Files
1 parent 0adbdf8 commit 0a86f29

File tree

107 files changed

+9547
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+9547
-0
lines changed

__pycache__/config.cpython-39.pyc

589 Bytes
Binary file not shown.

__pycache__/run.cpython-310.pyc

1.03 KB
Binary file not shown.

__pycache__/run.cpython-311.pyc

1.9 KB
Binary file not shown.

__pycache__/run.cpython-39.pyc

1.12 KB
Binary file not shown.

app/__init__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# app/__init__.py
2+
3+
from flask import Flask
4+
from flask_sqlalchemy import SQLAlchemy
5+
from app.extensions import db
6+
from dotenv import load_dotenv
7+
import os
8+
9+
def create_app():
10+
# Load environment variables from .env file
11+
load_dotenv()
12+
13+
app = Flask(__name__)
14+
15+
# Configuration
16+
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'fallback-secret-key')
17+
app.config['SQLALCHEMY_DATABASE_URI'] = (
18+
f"postgresql://{os.getenv('DB_USER')}:{os.getenv('DB_PASSWORD')}@{os.getenv('DB_HOST')}/{os.getenv('DB_NAME')}"
19+
)
20+
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
21+
22+
# Initialize extensions
23+
db.init_app(app)
24+
25+
# Import and register blueprints here to avoid circular import issues
26+
from app.routes.main_routes import main as main_routes
27+
from app.routes.api_routes import api as api_routes
28+
29+
app.register_blueprint(main_routes)
30+
app.register_blueprint(api_routes)
31+
32+
return app
930 Bytes
Binary file not shown.
1.56 KB
Binary file not shown.
782 Bytes
Binary file not shown.
261 Bytes
Binary file not shown.
351 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)