add flask migrate and flask.cli as well as got rid of db create all
This commit is contained in:
parent
0ac0e03e7a
commit
cb664a284c
1 changed files with 6 additions and 5 deletions
11
server.py
11
server.py
|
|
@ -2,6 +2,8 @@ import os
|
|||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
from dotenv import load_dotenv
|
||||
from flask_migrate import Migrate
|
||||
from flask.cli import FlaskGroup
|
||||
|
||||
from models import db, init_db
|
||||
from routes.user_auth import auth
|
||||
|
|
@ -13,9 +15,10 @@ app.config["SECRET_KEY"] = os.getenv("SECRET_KEY")
|
|||
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("DATABASE")
|
||||
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||
|
||||
CORS(app) # Consider specific origins in production
|
||||
CORS(app)
|
||||
|
||||
init_db(app)
|
||||
migrate = Migrate(app, db)
|
||||
app.register_blueprint(auth.auth_bp)
|
||||
|
||||
|
||||
|
|
@ -24,9 +27,7 @@ def health_check():
|
|||
"""Health check endpoint."""
|
||||
return "OK", 200
|
||||
|
||||
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
cli = FlaskGroup(app)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
cli()
|
||||
Loading…
Add table
Add a link
Reference in a new issue