1 Star 0 Fork 0

plusdo/todo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
local_code.py 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
plusdo 提交于 2015-11-29 09:29 . webpy开发的todo项目
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import web
from models.pduser import *
from models.login import *
reload(sys)
sys.setdefaultencoding('utf-8')
sys.path.append("./models")
from controllers import *
urls=("/account", account.app_account,
"/user",user.app_user,
"/tool",tool.app_tool,
"",index.app_index)
app = web.application(urls, globals(),autoreload=True)
def logininfo_hook():
#if file not request
web.ctx.sitehost = "http://"+web.ctx.env['HTTP_HOST']
if web.ctx.env['PATH_INFO']=="/favicon.ico":
return web.redirect("/static/ico/favicon.ico")
web.ctx.user = None
uid = Login.decode_cookie()
if uid and not web.ctx.get('user'):
user = pduser.load_by_id(uid)
if user is not None:
admin=set([100000])
if uid in admin:
user.isadmin = True
web.ctx.user = user
app.add_processor(web.loadhook(logininfo_hook))
if __name__ == "__main__":
#web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
app.run()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/plusdo/todo.git
git@gitee.com:plusdo/todo.git
plusdo
todo
todo
master

搜索帮助