did some code cleanup
This commit is contained in:
parent
3c130482d1
commit
5093bdd6cd
@ -4,7 +4,6 @@ from flask import Flask
|
|||||||
from the_works.database import init_db
|
from the_works.database import init_db
|
||||||
from flask_debugtoolbar import DebugToolbarExtension
|
from flask_debugtoolbar import DebugToolbarExtension
|
||||||
|
|
||||||
|
|
||||||
def create_app():
|
def create_app():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@ -14,13 +13,7 @@ def create_app():
|
|||||||
if os.getenv("SQLALCHEMY_DATABASE_DIALECT") == "sqlite":
|
if os.getenv("SQLALCHEMY_DATABASE_DIALECT") == "sqlite":
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///" + os.path.abspath(app.root_path + "/..") + "/" + os.getenv("SQLALCHEMY_DATABASE_SQLITE_FILENAME")
|
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///" + os.path.abspath(app.root_path + "/..") + "/" + os.getenv("SQLALCHEMY_DATABASE_SQLITE_FILENAME")
|
||||||
else:
|
else:
|
||||||
pass
|
exit("no SQLite database URI given; exiting")
|
||||||
|
|
||||||
# DEBUG
|
|
||||||
app.config["SQLALCHEMY_ECHO"] = True
|
|
||||||
|
|
||||||
print(f"Current Environment: " + app.config['ENVIRONMENT'])
|
|
||||||
print(f"SQLAlchemy DB URI: " + app.config['SQLALCHEMY_DATABASE_URI'])
|
|
||||||
|
|
||||||
# initialize database
|
# initialize database
|
||||||
init_db(app)
|
init_db(app)
|
||||||
@ -31,6 +24,9 @@ def create_app():
|
|||||||
app.register_blueprint(home.bp)
|
app.register_blueprint(home.bp)
|
||||||
app.register_blueprint(werk.bp)
|
app.register_blueprint(werk.bp)
|
||||||
|
|
||||||
|
### DEBUG
|
||||||
|
app.config["SQLALCHEMY_ECHO"] = True
|
||||||
|
print(f"Current Environment: " + app.config['ENVIRONMENT'])
|
||||||
# load debug toolbar
|
# load debug toolbar
|
||||||
toolbar = DebugToolbarExtension(app)
|
toolbar = DebugToolbarExtension(app)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user