-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
36 lines (28 loc) · 1.02 KB
/
app.py
File metadata and controls
36 lines (28 loc) · 1.02 KB
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
33
34
35
36
from flask import Flask
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, MigrateCommand
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from flask_jwt_extended import JWTManager
app = Flask(__name__)
jwt = JWTManager(app)
app.debug = True
DB_URI = "postgres://postgres:postgres@localhost:5432/postgres"
app.config['JWT_SECRET_KEY'] = '2F4A8B8690219C1841B865EB87E8EC40281F7784BA16AEF0408DC712A6F3B4D3'
app.config['SQLALCHEMY_DATABASE_URI'] = DB_URI
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
manager = Manager(app)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])
SessionFactory = sessionmaker(bind=engine)
BaseModel = declarative_base()
if __name__ == '__main__':
from models import *
from schemas import *
from blueprint import *
db.create_all()
app.run()