Beispiel #1
0
def init():
    app.config.from_pyfile('config.py')
    db.init_app(app)
    mail.init_app(app)
    import logging
    from logging import FileHandler
    from logging import Formatter

    file_handler = FileHandler(app.root_path + "/log/web_errors.log")
    file_handler.setLevel(logging.DEBUG)
    file_handler.setFormatter(Formatter(
        '%(asctime)s %(levelname)s: %(message)s '
        '[in %(pathname)s:%(lineno)d]'))
    app.logger.addHandler(file_handler)
    login_manager.init_app(app)
    login_manager.login_view = "main.login"
    app.register_blueprint(main)
    app.register_blueprint(admin)
    app.register_blueprint(profile)
    app.register_blueprint(ajax)
    patch_request_class(app, size=16*1024*1024)
    configure_uploads(app, resource)
Beispiel #2
0
def init():
    app.config.from_pyfile('config.py')
    db.init_app(app)
    mail.init_app(app)
    import logging
    from logging import FileHandler
    from logging import Formatter

    file_handler = FileHandler(app.root_path + "/log/web_errors.log")
    file_handler.setLevel(logging.DEBUG)
    file_handler.setFormatter(Formatter(
        '%(asctime)s %(levelname)s: %(message)s '
        '[in %(pathname)s:%(lineno)d]'))
    app.logger.addHandler(file_handler)
    login_manager.init_app(app)
    login_manager.login_view = "main.login"
    app.register_blueprint(main)
    app.register_blueprint(admin)
    app.register_blueprint(profile)
    app.register_blueprint(ajax)
    patch_request_class(app, size=16*1024*1024)
    configure_uploads(app, resource)
Beispiel #3
0
# coding=utf-8
from dao.db import db
from flask import Flask
from dao.dbBase import  User
import config
from dao.dbACCOUNT import Account
from dao.dbSUBMIT import Submit
from dao.dbResource import Resource
from dao.dbHonor import Honor

from dao.dbArticle import  *
from dao.dbTag import Tag
from dao.dbNews import News
from dao.dbCompetition import Competition
from dao.dbPlayer import Player

if __name__ == "__main__":
    app = Flask(__name__)
    app.config.from_pyfile('config.py')
    db.init_app(app)
    with app.app_context():
        db.drop_all(bind=['competitions'])
        db.create_all(bind=['competitions'])

from flask import Flask
from dao.dbBase import User
import config
from dao.dbACCOUNT import Account
from dao.dbSUBMIT import Submit
from dao.dbResource import Resource
from dao.dbHonor import Honor

from dao.dbArticle import *
from dao.dbTag import Tag
from dao.dbNews import News

if __name__ == "__main__":
    app = Flask(__name__)
    app.config.from_pyfile('config.py')
    db.init_app(app)
    with app.app_context():
        db.drop_all()
        db.create_all()
        user = User(username='******',
                    name=u'祝志颖',
                    password='******',
                    school='cuit',
                    gender=True,
                    email='*****@*****.**')
        user.rights = 5
        user.save()
        user = User(username='******',
                    name=u'彭潇',
                    password='******',
                    school='cuit',