mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-19 09:44:52 +00:00
Switch to Postgres database
This commit is contained in:
parent
fda3fcc28c
commit
5248ae0123
6 changed files with 67 additions and 19 deletions
|
@ -1,7 +1,5 @@
|
|||
import os
|
||||
|
||||
from flask import Flask
|
||||
from flask_migrate import init as migrate_init
|
||||
from extensions import db, migrate, cache
|
||||
from config import MIGRATION_DIR, INSTANCE_DIR
|
||||
from views import blueprint
|
||||
|
@ -13,12 +11,7 @@ db.init_app(app)
|
|||
migrate.init_app(app, db, directory=MIGRATION_DIR)
|
||||
cache.init_app(app)
|
||||
|
||||
if not os.path.exists(os.path.join(INSTANCE_DIR, 'db.sqlite')):
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
|
||||
if not os.path.exists(MIGRATION_DIR):
|
||||
with app.app_context():
|
||||
migrate_init(directory=MIGRATION_DIR)
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
|
||||
app.register_blueprint(blueprint)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue