나는 내 웹 사이트에 Django과 토네이도의 조합을 사용합니다. 토네이도는 훌륭한 인증 시스템을 가지고 있으며 장고보기에서 사용하고 싶습니다. 불행히도 AttributeError
이 있습니다.django보기에서 토네이도 인증을 사용하는 방법?
어떻게 장고보기에서 토네이도 인증을 사용할 수 있습니까?
보기
import tornado.web
from django import shortcuts
@tornado.web.authenticated
def testpage(request):
return shortcuts.render(request, 'web/templates/index.html')
AttributeError: 'WSGIRequest' object has no attribute 'current_user'
장고 WSGIContainer
을 통해 토네이도에 연결되어있는 오류 메시지 :
def main():
static_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'static')
assert os.path.isdir(static_path), static_path
wsgi_app = tornado.wsgi.WSGIContainer(
django.core.handlers.wsgi.WSGIHandler())
tornado_app = tornado.web.Application([],static_path=static_path,)
server = tornado.httpserver.HTTPServer(tornado_app)
server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == '__main__':
main()
왜 당신은 장고에서 인증 된 토네이도에 대한 대안을 사용합니까? 'login_required' (소스 : https://docs.djangoproject.com/en/1.5/topics/auth/default/#the-login-required-decorator)와 같은 django 데코레이터를 사용할 수 있습니다. – scriptmonster
Tornado는 Facebook, Google, Twitter 및 OAuth2 인증을 매우 간단하게 지원합니다. – Jon