Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a5f8ba7a84
82 changed files with 17797 additions and 40 deletions
|
|
@ -1,6 +1,34 @@
|
|||
from application import create_app
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from ddtrace import patch_all
|
||||
import sys
|
||||
import os
|
||||
|
||||
db = SQLAlchemy()
|
||||
patch_all()
|
||||
|
||||
app = create_app()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host='0.0.0.0')
|
||||
app = Flask(__name__)
|
||||
FLASK_ENV = os.environ.get('FLASK_ENV', None)
|
||||
if FLASK_ENV == 'production':
|
||||
app.config.from_object("config.ProductionConfig")
|
||||
elif FLASK_ENV == 'staging':
|
||||
app.config.from_object("config.StagingConfig")
|
||||
elif FLASK_ENV == 'development':
|
||||
app.config.from_object("config.DevelopmentConfig")
|
||||
else:
|
||||
app.config.from_object("config.Config")
|
||||
|
||||
if app.config['SQLALCHEMY_DATABASE_URI_1'] is None or app.config['SQLALCHEMY_DATABASE_URI_2'] is None:
|
||||
print('No ENV Variables for DATABASE_URL_1 or DATABASE_URL_2')
|
||||
sys.exit(1)
|
||||
else:
|
||||
print('ENV Variables passed : ', app.config['SQLALCHEMY_BINDS'])
|
||||
|
||||
# db.init_app(app)
|
||||
# with app.app_context():
|
||||
# from . import routes
|
||||
# db.create_all()
|
||||
PORT = os.environ.get('PORT', 4999)
|
||||
app.run(host='0.0.0.0', port=PORT)
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from ddtrace import patch_all
|
||||
import sys
|
||||
import os
|
||||
|
||||
db = SQLAlchemy()
|
||||
patch_all()
|
||||
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
FLASK_ENV = os.environ.get('FLASK_ENV', None)
|
||||
if FLASK_ENV == 'production':
|
||||
app.config.from_object("config.ProductionConfig")
|
||||
elif FLASK_ENV == 'staging':
|
||||
app.config.from_object("config.StagingConfig")
|
||||
elif FLASK_ENV == 'development':
|
||||
app.config.from_object("config.DevelopmentConfig")
|
||||
else:
|
||||
app.config.from_object("config.Config")
|
||||
|
||||
if app.config['SQLALCHEMY_DATABASE_URI_1'] is None or app.config['SQLALCHEMY_DATABASE_URI_2'] is None:
|
||||
print('No ENV Variable for DATABASE_URL_1 or DATABASE_URL_2')
|
||||
sys.exit(1)
|
||||
|
||||
db.init_app(app)
|
||||
with app.app_context():
|
||||
from . import routes
|
||||
db.create_all()
|
||||
return app
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from . import db
|
||||
from app import db
|
||||
|
||||
|
||||
class Logs(db.Model):
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
from flask import current_app as app
|
||||
from flask import request
|
||||
from .logs_model import Logs, db
|
||||
from .users_model import Users, db
|
||||
from .responses import send_message, send_error
|
||||
from logs_model import db
|
||||
from users_model import Users, db
|
||||
from responses import send_message, send_error
|
||||
|
||||
|
||||
# Login
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from . import db
|
||||
from app import db
|
||||
|
||||
|
||||
class Users(db.Model):
|
||||
Loading…
Add table
Add a link
Reference in a new issue