#!/usr/bin/env python #coding=utf-8 __author__ = 'vzer' from flask_script import Manager,Server from applications import create_app server=Server(host="0.0.0.0",port=5001) app=create_app() manager=Manager(app) manager.add_command("runserver", server) if __name__ == '__main__': manager.run()
import json from applications import create_app, db from applications.models import models from applications.models.models import User from flask_migrate import Migrate from flask_jwt_extended import create_access_token from flask_jwt_extended import current_user from flask_jwt_extended import jwt_required from flask_jwt_extended import JWTManager app = create_app() with open('configurations/db_config.json', 'r') as f: conf = json.loads(f.read()) mysql_conf = conf['MYSQL'] # mongo_conf = conf['MONGO'] app.config[ 'SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE_NAME}".format( **mysql_conf) app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False with open('configurations/security_config.json', 'r') as s: conf = json.loads(s.read()) app.config['JWT_SECRET_KEY'] = conf['SECRET_KEY'] app.config['JWT_ACCESS_TOKEN_EXPIRES'] = conf[ 'TOKEN_VALIDITY_DURATION_SECONDS'] app.config['JWT_BLACKLIST_ENABLED'] = False app.config['JWT_BLACKLIST_TOKEN_CHECKS'] = ['access'] jwt = JWTManager(app)
from applications import create_app app = create_app('testing') if __name__ == '__main__': app.run(debug=True)