GAE项目的自定义用户身份验证

时间:2015-10-13 15:16:50

标签: python django google-app-engine

我正在尝试使用webapp2-user-accounts project对我的项目文件进行自定义用户身份验证the Google Analytics Embed API project.基本上我想将每个项目的工作功能合并到一个项目中 - 我可以让每个项目都单独工作但不能让他们一起工作!

我已经在app.yaml上更新了处理程序以组合两个项目(可能在哪里我可能会出错)。这是:

# For production:
application: ga-dev-tools

# For staging:
# application: google.com:ga-dev-tools

version: v9-1-3
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico
  secure: always
- url: /public
  static_dir: public
  secure: always

#my webapp2-user-accounts-handlers.
- url: /signup
  script: main.app
  secure: always
- url: /login
  script: main.app
  secure: always
- url: /forgot
  script: main.app
  secure: always  
  #my ga-dev-tools-handlers.
- url: /server-side-authorization/
  script: lib.app.router
  secure: always
- url: .*
  script: main.app

 libraries:
- name: webapp2
  version: "2.5.2"
- name: jinja2
  version: "2.6"
- name: yaml
  version: "3.10"
- name: pycrypto
  version: "2.6"

  skip_files:
- ^node_modules

我还将main.py文件指向经过身份验证的文件的新位置。

但是,在部署到appspot后,我的登录页面按预期工作但登录后。我的安全'页面抛出以下内部服务器错误消息:

Traceback (most recent call last):
File     "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File     "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File    "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/apps/s~abdash-1087/v9-1-3.387821826733681198/main.py", line 96, in dispatch
webapp2.RequestHandler.dispatch(self)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
 File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
 File "/base/data/home/apps/s~abdash-1087/v9-1-3.387821826733681198/main.py", line 26, in check_login
return handler(self, *args, **kwargs)
File "/base/data/home/apps/s~abdash-1087/v9-1-3.387821826733681198/main.py", line 266, in get
self.render_template('/server-side-authorization')
 File "/base/data/home/apps/s~abdash-1087/v9-1-3.387821826733681198/main.py", line 80, in render_template
self.response.out.write(template.render(path, params))
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/webapp/template.py", line 91, in render
t = _load_internal_django(template_path, debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/webapp/template.py", line 165, in _load_internal_django
template = django.template.loader.get_template(file_name)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loader.py", line 157, in get_template
template, origin = find_template(template_name)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: server-side-authorization  

如果有人能指出我可能出错的大方向,我将非常感激。

提前谢谢你。

1 个答案:

答案 0 :(得分:1)

通过更改Tim Hoffman建议的django模板的配置设置解决了这个问题。这不是app.yaml问题(正如我之前所想的那样)。