Exemplo n.º 1
0
    file_handler.setLevel(app.config.get("LOGGING_LEVEL"))
    file_handler.setFormatter(logging.Formatter('''
    Message type:       %(levelname)s
    Location:           %(pathname)s:%(lineno)d
    Function:           %(funcName)s
    Time:               %(asctime)s
    Message:            %(message)s
    '''))
    app.logger.addHandler(file_handler)


#===============================================================================
# sys.py
#===============================================================================
import views.sys as s
for error_code in [403, 404] : app.error_handler_spec[None][error_code] = s.error_page(error_code)


#===============================================================================
# root.py
#===============================================================================
# import views.root as r
# app.add_url_rule("/", view_func = r.index, methods = ['GET', 'POST'])
# app.add_url_rule("/index", view_func = r.index, methods = ['GET', 'POST'])



#===============================================================================
# access.py
#===============================================================================
# import views.access as a
Exemplo n.º 2
0
    file_handler = logging.handlers.TimedRotatingFileHandler(app.config.get("LOGGING_FILE_PATH"), when = 'D', interval = 1, backupCount = 5, encoding = "utf-8", delay = False)
    file_handler.setLevel(app.config.get("LOGGING_LEVEL"))
    file_handler.setFormatter(logging.Formatter('''
    Message type:       %(levelname)s
    Location:           %(pathname)s:%(lineno)d
    Function:           %(funcName)s
    Time:               %(asctime)s
    Message:            %(message)s
    '''))
    app.logger.addHandler(file_handler)

#===============================================================================
# sys.py
#===============================================================================
import views.sys as s
for error_code in [403, 404, 500] : app.error_handler_spec[error_code] = s.error_page(error_code)


#===============================================================================
# api.sys
#===============================================================================
import views.api as api
app.add_url_rule("/api", view_func = api.doAction, methods = ['GET', 'POST'])
#===============================================================================
# root.py
#===============================================================================
import views.root as r
app.add_url_rule("/test", view_func = r.test)
app.add_url_rule("/", view_func = r.index)
app.add_url_rule("/index", view_func = r.index)
app.add_url_rule("/search", view_func = r.search)
Exemplo n.º 3
0
    file_handler = logging.handlers.TimedRotatingFileHandler(app.config.get("LOGGING_FILE_PATH"), when = 'D', interval = 1, backupCount = 5, encoding = "utf-8", delay = False)
    file_handler.setLevel(app.config.get("LoGGING_LEVEL"))
    file_handler.setFormatter(logging.Formatter('''
    Message type:       %(levelname)s
    Location:           %(pathname)s:%(lineno)d
    Function:           %(funcName)s
    Time:               %(asctime)s
    Message:            %(message)s
    '''))
    app.logger.addHandler(file_handler)

#===============================================================================
# sys.py
#===============================================================================
import views.sys as s
for error_code in [403, 404, 500] : app.error_handlers[error_code] = s.error_page(error_code)


#===============================================================================
# root.py
#===============================================================================
import views.root as r
app.add_url_rule("/test", view_func = r.test)
app.add_url_rule("/", view_func = r.index)
app.add_url_rule("/index", view_func = r.index)
app.add_url_rule("/search", view_func = r.search)
app.add_url_rule("/login", view_func = r.login)
app.add_url_rule("/register", view_func = r.register)
app.add_url_rule("/check_email", view_func = r.check_email)
app.add_url_rule("/save_register", view_func = r.save_register, methods = ['POST'])
app.add_url_rule("/login_handler", view_func = r.login_handler, methods = ['GET', 'POST'])