Skip to content

Commit

Permalink
Merge pull request #46 from cf15-t5/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
lutfianRhdn authored Aug 24, 2023
2 parents e3a14c9 + edd45f5 commit 677b636
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/config/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
from src.config.config import DATABASE_URL

def database(app):
app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URL
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
print("[INFO] Database connected")
global db
if 'db' not in globals():
app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URL
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
print("[INFO] Database connected")
return db

def generateDatabase(main_app,db):
with main_app.app_context():
db.create_all()

0 comments on commit 677b636

Please sign in to comment.