Load configuration from file

master
Nikola Forró 7 years ago
parent 42cbc714f0
commit c5226fd683

1
.gitignore vendored

@ -1 +1,2 @@
quotes.db quotes.db
settings.cfg

@ -1,5 +1,3 @@
import os
import flask import flask
import flask_cors import flask_cors
import flask_login import flask_login
@ -11,11 +9,8 @@ import itsdangerous
import sqlalchemy import sqlalchemy
DB_PATH = os.path.expandvars('$HOME/quotes/quotes.db')
app = flask.Flask(__name__) app = flask.Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_PATH}' app.config.from_envvar('SETTINGS')
app.config['ERROR_404_HELP'] = False
db = flask_sqlalchemy.SQLAlchemy(app) db = flask_sqlalchemy.SQLAlchemy(app)
db.create_all() db.create_all()

Loading…
Cancel
Save