时间:2021-07-01 10:21:17 帮助过:97人阅读
index.wsgi
#!/usr/bin/env python # coding: utf-8 import os import web import sae from config.url import urls from config import settings #是否具有调试功能 web.config.debug = False # app = web.application(urls, globals()).wsgifunc() # application = sae.create_wsgi_app(app) #解决Session在SAE中的问题 app = web.application(urls, globals()) #将session保存在数据库中 db = settings.db store = web.session.DBStore(db, 'sessions') #session = web.session.Session(app, store, initializer={'access_token': 'true'}) session = web.session.Session(app, store) web.config._session = session application = sae.create_wsgi_app(app.wsgifunc()) url.py #!/usr/bin/env python # coding: utf-8 pre_fix = 'controllers.' urls = ( '/', pre_fix + 'todo.Index', '/todo/new', pre_fix + 'todo.New', '/todo/(\d+)', pre_fix + 'todo.View', '/todo/(\d+)/edit', pre_fix + 'todo.Edit', '/todo/(\d+)/delete', pre_fix + 'todo.Delete', '/todo/(\d+)/finish', pre_fix + 'todo.Finish', '/todo/login', pre_fix + 'login.LoginUser', '/todo/checkuser',pre_fix+'login.CheckUser', '/todo/reset',pre_fix+'todo.reset', '/todo/saveupload','mycontrollers.saveupload.SaveUpload' ) setting.py #!/usr/bin/env python # coding: utf-8 import web import sae.const #数据库设定 db = web.database(dbn='mysql', user=sae.const.MYSQL_USER, pw=sae.const.MYSQL_PASS, host=sae.const.MYSQL_HOST, port=3307, db=sae.const.MYSQL_DB) #模板设定 render = web.template.render('templates/', cache=False) config = web.storage( email='oooo@qq.com