forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.py
More file actions
32 lines (25 loc) · 694 Bytes
/
manage.py
File metadata and controls
32 lines (25 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from flask import Flask
from flask_migrate import Migrate, MigrateCommand, init, migrate, upgrade
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from db import (
DB_NAME,
DB_HOST,
DB_PASS,
DB_USER,
DB_PORT,
)
app = Flask(__name__)
app.config[
"SQLALCHEMY_DATABASE_URI"
] = f"postgresql+psycopg2://{DB_USER}:{DB_PASS}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
db.init_app(app)
migrate_app = Migrate(app, db)
manager = Manager(app)
manager.add_command("db", MigrateCommand)
if __name__ == "__main__":
manager.run()