mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
Merge pull request #190 from spiral-project/use-app-root
Use app.root_path instead of __HERE__
This commit is contained in:
commit
bf2c11f8a9
1 changed files with 3 additions and 4 deletions
|
@ -12,8 +12,6 @@ from api import api
|
||||||
from utils import PrefixedWSGI
|
from utils import PrefixedWSGI
|
||||||
from utils import minimal_round
|
from utils import minimal_round
|
||||||
|
|
||||||
__HERE__ = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,15 +57,16 @@ db.app = app
|
||||||
|
|
||||||
# db migrations
|
# db migrations
|
||||||
migrate = Migrate(app, db)
|
migrate = Migrate(app, db)
|
||||||
|
migrations_path = os.path.join(app.root_path, 'migrations')
|
||||||
|
|
||||||
if pre_alembic_db():
|
if pre_alembic_db():
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
# fake the first migration
|
# fake the first migration
|
||||||
stamp(revision='b9a10d5d63ce')
|
stamp(migrations_path, revision='b9a10d5d63ce')
|
||||||
|
|
||||||
# auto-execute migrations on runtime
|
# auto-execute migrations on runtime
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
upgrade(os.path.join(__HERE__, 'migrations'))
|
upgrade(migrations_path)
|
||||||
|
|
||||||
# mail
|
# mail
|
||||||
mail.init_app(app)
|
mail.init_app(app)
|
||||||
|
|
Loading…
Reference in a new issue