在GAE上与django的gae会议

时间:2011-07-26 16:48:14

标签: python django google-app-engine

请对此有所帮助。以下是我的错误追溯。我在GAE上使用django 1.2的gaesessions。我收到了以下错误:

    Traceback (most recent call last):
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4053, in _HandleRequest
    self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3977, in _Dispatch
    base_env_dict=env_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 588, in Dispatch
    base_env_dict=base_env_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3050, in Dispatch
    self._module_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2954, in ExecuteCGI
    reset_modules = exec_script(handler_path, cgi_path, hook)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2834, in ExecuteOrImportScript
    exec module_code in script_module.__dict__
  File "D:\projects\tutorial\selftutor.py", line 38, in <module>
    main()
  File "D:\projects\tutorial\selftutor.py", line 35, in main
    util.run_wsgi_app(application)
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 98, in run_wsgi_app
    run_bare_wsgi_app(add_wsgi_middleware(application))
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 116, in run_bare_wsgi_app
    result = application(env, _start_response)
  File "C:\Program Files\Google\google_appengine\lib\django_1_2\django\core\handlers\wsgi.py", line 252, in __call__
    response = middleware_method(request, response)
  File "D:\projects\tutorial\gaesessions\__init__.py", line 491, in process_response
    if request.session.is_accessed():
AttributeError: 'WSGIRequest' object has no attribute 'session'

在一个链接上它正在运行。没有错误,但显示另一个错误。当我使用pycharm'process_request'调试代码时,'DjangoSessionMiddleware'的功能永远不会输入。我不知道问题是什么。请任何人帮忙吗?

2 个答案:

答案 0 :(得分:0)

来自https://github.com/dound/gae-sessions#readme

  

如果你想与Django进行gae-sessions,请添加   'gaesessions.DjangoSessionMiddleware'到你的清单   settings.py文件中的MIDDLEWARE_CLASSES。然后,您可以访问   通过request.session与当前请求关联的会话   变量。要配置Django中间件,请修改以下内容   在gaesessions / __ init __。py:

self.wrapped_wsgi_middleware = SessionMiddleware(fake_app, cookie_key='you MUST change this')

答案 1 :(得分:0)

我已经遇到过这个错误很多次了。出现此错误的原因是views.py中的代码缩进不正确。