import sys import web from utils import baseutils from utils.baserender import render from utils.baseauth import auth_admin APPS = ("novel", "admin") web.config.debug = False web.replace_header = baseutils.replace_header # 设置时区 baseutils.switch_time_zone() urls = baseutils.import_modules(APPS) app = web.application(urls, globals(), autoreload=False) session = web.session.Session(app, web.session.DiskStore("sessions")) web.config._session = session def notfound(): return web.notfound(render.notfound()) app.notfound = notfound app.add_processor(web.loadhook(auth_admin)) app.add_processor(web.unloadhook(baseutils.assert_closed)) if __name__ == "__main__": if len(sys.argv) == 1:
import web from utils.baseutils import import_modules, switch_time_zone from utils.baseauth import admin_auth from db_init import db_init APPS = ("apps",) web.config.debug = False #configure the mail settings web.config.smtp_server = 'smtp.gmail.com' web.config.smtp_port = 587 web.config.smtp_username = '******' web.config.smtp_password = '******' web.config.smtp_starttls = True app = web.application(import_modules(APPS), autoreload=False) session = web.session.Session(app, web.session.DiskStore('sessions')) web.config._session = session app.add_processor(web.loadhook(admin_auth)) if __name__ == '__main__': switch_time_zone() db_init() if "deploy" in sys.argv: from flup.server.fcgi import WSGIServer func = app.wsgifunc() server_address = '/tmp/miniblog.sock' WSGIServer(
import sys import web from utils import baseutils from utils.baserender import render from utils.baseauth import auth_admin APPS = ("novel", "admin") web.config.debug = False web.replace_header = baseutils.replace_header # 设置时区 baseutils.switch_time_zone() urls = baseutils.import_modules(APPS) app = web.application(urls, globals(), autoreload=False) session = web.session.Session(app, web.session.DiskStore('sessions')) web.config._session = session def notfound(): return web.notfound(render.notfound()) app.notfound = notfound app.add_processor(web.loadhook(auth_admin)) app.add_processor(web.unloadhook(baseutils.assert_closed)) if __name__ == '__main__': if len(sys.argv) == 1: