Python运行报'Application' object has no attribute 'transforms'
在运行Python编码的网站时出现AttributeError: 'Application' object has no attribute 'transforms'.的错误。win10环境,Python2.7,tornado 2.3,tornado-redis 2.4.18。请问有没有人遇到过这个问题
huang
下面是代码,manage.py
#-*- coding: UTF-8 -*-import os.path
from tornado.options import define, options
import tornado.httpserver
import tornado.ioloop
import tornado.web
from iseecore.routes import route
from iseecore.services import init_service
import setting
from tornadomail.backends.smtp import EmailBackend
define("port", default=8008, help="Run server on a specific port", type=int)
class Application(tornado.web.Application):
def __init__(self):
def init():
init_service.load_init_services()
import views
handlers = route.get_routes()
settings = dict(
blog_title = u"IsWeb",
template_path = os.path.join(os.path.dirname(__file__), "template"),
static_path = os.path.join(os.path.dirname(__file__), "static"),
static_url_prefix =setting.STATIC_URL_PREFIX,
debug = True,
cookie_secret = "NyM8vWu0Slec0GLonsdI3ebBX0VEqU3Vm8MsHiN5rrc=",
app_secret = "XOJOwYhNTgOTJqnrszG3hWuAsTmVz0GisOCY6R5d1E8=",
login_url = "/",
# autoescape = None,
gzip = True,
)
redis_setting = {
'host': setting.REDIS_HOST,
'port': setting.REDIS_PORT,
'db_sessions': setting.REDIS_SESSIONS,
'password': setting.REDIS_PASSWORD,
#'max_connections' : 30,
}
settings['session'] = {
'engine' : 'redis',
'storage' : redis_setting,
'cookies' : {
'expires_days' : 1
}
}
tornado.web.Application.__init__(self, handlers, **settings)
# init amqp
#from services.tool.amqp import Rabbitmq
#Rabbitmq(back = init)
@property
def mail_connection(self):
return EmailBackend(
setting.mail_smtp,
setting.mail_port,
setting.mail_mail,
setting.mail_passwd,
True,
proxy_host = setting.proxy_host,
proxy_port = setting.proxy_port,
)
@property
def base_file_path(self):
return os.path.dirname(__file__)
def main():
options.log_to_stderr = True
options.logging = 'info'
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.locale.load_translations(
os.path.join(os.path.dirname(__file__), "translations")
)
# tornado.locale.set_default_locale("zh_CN")
tornado.ioloop.IOLoop.instance().start()
if __name__ == '__main__':
main()
以上是 Python运行报'Application' object has no attribute 'transforms' 的全部内容, 来源链接: utcz.com/a/160591.html