40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
from flask import Flask, redirect, url_for
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_migrate import Migrate
|
|
from flask_login import LoginManager
|
|
from sqlalchemy import MetaData
|
|
|
|
convention = {
|
|
"ix": 'ix_%(column_0_label)s',
|
|
"uq": "uq_%(table_name)s_%(column_0_name)s",
|
|
"ck": "ck_%(table_name)s_%(constraint_name)s",
|
|
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
|
|
"pk": "pk_%(table_name)s"
|
|
}
|
|
|
|
metadata = MetaData(naming_convention=convention)
|
|
|
|
|
|
app = Flask(__name__)
|
|
app.config['SECRET_KEY'] = 'secret_key'
|
|
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqlconnector://sarbaseuser:password@localhost/sarbaseapp'
|
|
db = SQLAlchemy(app, metadata=metadata)
|
|
migrate = Migrate(app, db)
|
|
login_manager = LoginManager(app)
|
|
|
|
import models
|
|
import admin
|
|
import login
|
|
import sar_calls
|
|
import dashboard
|
|
|
|
|
|
@app.route('/')
|
|
def hello_world(): # put application's code here
|
|
return redirect(url_for('dashboard'))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run()
|