0

I am playing around with Google Course Builder. It's built using Google App Engine and the webapp2 framework.

I am not very familiar with webapp2 and routing in general and I think that's the reason for my doubt. And perhaps the people who have previously worked on GCB would be able to answer this question.

I am editing a view (as in MVC). It's an HTML file. I created a hyperlink to an another view (which is an HTML file I created myself), but I am getting a 404 when I click on the link.

I tried out all possible variations to the file location.

href="views/doubts.html" 

would open "localhost:8080/views/doubts.html". But it gives me a 404 even thought he file exists. I tried out all variations ("/views/doubts", just "doubts.html", "doubts" and so on).

Perhaps direct access to the views might be blocked by some other part of the application. In such a case, what is the preferred way to go about it? Do I have to create a controller which redirects or so? I have never used MVC before.

4

1 回答 1

0

检查第app.yaml一个。决定gogoleapp.yaml应用引擎如何响应每种请求。 https://developers.google.com/appengine/docs/python/config/appconfig

基本上,谷歌应用引擎有两种方式来响应请求。

  1. 通过静态文件响应 https://developers.google.com/appengine/docs/python/config/appconfig#Static_File_Handlers

静态文件是针对给定 URL 直接提供给用户的文件,例如图像、CSS 样式表或 JavaScript 源文件。静态文件处理程序描述应用程序目录中的哪些文件是静态文件,以及哪些 URL 为它们提供服务。

2. 通过脚本 https://developers.google.com/appengine/docs/python/config/appconfig#Script_Handlers响应

脚本处理程序执行 Python 脚本来处理与 URL 模式匹配的请求。该映射定义了要匹配的 URL 模式以及要执行的脚本。在 Python 2.5 中,CGI 是定义脚本处理程序的首选方法。在 Python 2.7 中,WSGI 是首选方法。CGI 在 Python 2.7 中工作,但运行时的某些功能(例如并发请求)只有在您的应用程序使用 WSGI 时才可用。

1) 方法允许用户托管一个简单的静态网站,而无需触摸webapp2url routing

于 2013-05-15T15:33:05.087 回答