2015-10-13 45 views
1

我想使用此webapp2-user-accounts project用於我的項目文件的自定義用戶身份驗證使用the Google Analytics Embed API project.本質上我想將每個項目的工作功能組合到一個項目中 - 我可以讓每個項目單獨工作但不能讓他們一起工作!GAE項目的自定義用戶身份驗證

我更新了我的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 

如果任何人都可以在我可能會錯誤的大方向指向我,我將非常感激。

預先感謝您。

+0

你看過錯誤嗎?它說它無法加載Django模板。你需要看看你的django配置,並檢查你的模板定義在哪裏,看看它們現在是否合理。 –

+0

非常感謝蒂姆。經過多次試驗和錯誤,我終於到了那裏,你是對的。這是一個模板問題,不是app.yaml的問題。 – AnthonyOsborn2

回答

1

這可以通過更改Tim Hoffman建議的django模板的配置設置來解決。這不是一個app.yaml問題(正如我以前的想法)。