예제 #1
0
def create_app():
    app = Flask(__name__, template_folder='templates')
    app.config['SECRET_KEY'] = 'hjb,n'
    app.config['MAIL_DEBUG'] = MAIL_DEBUG
    app.config['MAIL_SERVER'] = MAIL_SERVER
    app.config['MAIL_PORT'] = MAIL_PORT
    app.config['MAIL_USE_TLS'] = MAIL_USE_TLS
    app.config['MAIL_USE_SSL'] = MAIL_USE_SSL
    app.config['MAIL_USERNAME'] = MAIL_USERNAME
    app.config['MAIL_PASSWORD'] = MAIL_PASSWORD
    app.config['MAIL_DEFAULT_SENDER'] = MAIL_DEFAULT_SENDER
    mail = Mail(app)
    toastr = Toastr(app)
    return app
예제 #2
0
파일: app.py 프로젝트: pkErbynn/IoT-WQMS
# from aquaLite import *
import datetime
import json
import sqlite3
import time
import statistics as stat
import mail
from config import credential
import generator
from flask_toastr import Toastr  # toastr module import
import create_database

app = Flask(__name__)

# python notification toaster
toastr = Toastr(app)

# Set the secret_key on the application to something unique and secret.
app.config['SECRET_KEY'] = '5791628bb0b13ce0c676dfde280ba245'


# home route....landing page
@app.route("/", methods=['GET', 'POST'])
@app.route("/index", methods=["GET", "POST"])
def index():
    print("landing page running...")
    if request.method == 'POST':
        username = request.form['username']
        passwd = request.form['password']

        # credentials from config files imported
예제 #3
0
from models import Loteria, Sorteo

db_dir = os.path.dirname(os.path.abspath(__file__))
db_file = f'sqlite:///{os.path.join(db_dir, "loto.db")}'

print('db_file:', db_file)

app = Flask(__name__)

app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = db_file
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['SECRET_KEY'] = 'Llave_Muy_Secreta'
app.config['TOASTR_TIMEOUT'] = 15000

toastr = Toastr()
# deboogtoolb = DebugToolbarExtension()

toastr.init_app(app)
# deboogtoolb.init_app(app)

db.init_app(app)

meses = ('Mes-Incorrecto', 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo',
         'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviebre',
         'Diciembre')


def crear_muestra():
    db.session.remove()
    db.drop_all()
예제 #4
0
# App config and database init
db = SQLAlchemy()

# Password hashing
bcrypt = Bcrypt()

# Login config
login_manager = LoginManager()
login_manager.login_view = 'users.login'
login_manager.login_message_category = 'info'

# Json data loading and config
json_data = os.path.join(Config.SITE_ROOT, "static/data", "tokensData.json")
token_data = json.load(open(json_data))

toastr = Toastr()


def create_app(config_class=Config):
    """ app creation - set template folder and init app and blueprints"""

    app = Flask(__name__, template_folder='templates')
    app.config.from_object(Config)

    db.init_app(app)
    heroku.init_app(app)
    bcrypt.init_app(app)
    login_manager.init_app(app)
    toastr.init_app(app)

    from app.users.routes import users
예제 #5
0
def register_feature(app):
    CSRFProtect(app)
    MongoEngine(app)
    toastr = Toastr(app)