Skip to content

Commit

Permalink
Merge pull request #4 from priestyMe/dev-setup
Browse files Browse the repository at this point in the history
updated setup files
  • Loading branch information
priestyMe authored Oct 16, 2024
2 parents a70fba2 + b699fcf commit 5939f9f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import os
from flask import Flask
from flask.cli import load_dotenv
from flask_sqlalchemy import SQLAlchemy

# Create a database instance
db = SQLAlchemy()

def create_app():
app = Flask(__name__)


load_dotenv() # Load environment variables from .env file

DB_USER = os.getenv('DB_USER')
DB_PASSWORD = os.getenv('DB_PASSWORD')

app.config['SQLALCHEMY_DATABASE_URI'] = f'mssql+pyodbc://{DB_USER}:{DB_PASSWORD}@ptfoliodemoserver.database.windows.net/ptfdatabase?driver=ODBC+Driver+17+for+SQL+Server'

# Initialize the app with the database
db.init_app(app)

Expand Down

0 comments on commit 5939f9f

Please sign in to comment.