在使用本地SDK服务器时,在实时Google App Engine上使用404 [英] 404 on live Google App Engine, while working on local SDK server
问题描述
我已经在GAE标准环境中部署了几个PHP应用程序,一切正常。
现在我正在部署一个新应用程序,它在本地服务器上提供 gcloud
SDK按预期工作(终端命令: dev_appserver.py --log_level =警告app.yaml
)。 p>
问题是,当我将它部署到实时GAE服务时( gcloud app deploy app.yaml --project myapp
),我得到一个404错误信息:
无法找到页面
没有网页找到的网址是:xxx
HTTP错误404
app.yaml看起来像这样:
运行时:php55
api_version:1
线程安全:true
skip_files:
- README.md
- package.json
处理程序:
- url:/(.*\\.html)
script:mod_rewrite.php
secure:总是
- url:/(.*\..{{2,})
static_files:\ 1
上传:(。* \ .. {2 ,})
secure:总是
- url:/.*
script:mod_rewrite.php
secure:总是
我也尝试添加指向特定文件的测试处理程序:
- url:/(mytest\.html)
static_files:\ 1
上传:mytest.html
安全:总是
通过这种方式,我可以访问网址。但就是这样。
有趣的是,在当前GAE应用程序的
版本
选项卡上部署的版本,它表明应用程序是0 B
,即使它没有以前的版本,但它应该在30 Mb左右。部署时,所有988个文件似乎都已上传,也是因为由于我的网络连接速度较慢,所以需要一段时间。
我试图将整个东西重新部署到新的项目,在成功完成教程之后,我仍然遇到同样的问题。
解决方案您可以使用
application_readable
处理程序选项以将相应的静态文件包含在应用程序代码中。从处理程序元素:
application_readable
可选。布尔。默认情况下,在静态文件处理程序
中声明的文件将作为静态数据上传,并仅供最终用户使用。它们
不能被应用程序读取。如果此字段设置为true,那么
文件也会作为代码数据上传,以便您的应用程序可以读取它们的
。这两种上传都是针对您的代码和静态数据收取的
存储资源配额
像这样:
- url:/(.*\..{2,})
static_files:\ 1
upload:(。* \ .. {2,})
application_readable :true
secure:总是
I have deployed several PHP apps on GAE standard environment, all working fine.
Now I'm deploying a new app, which on the local server provided by the
gcloud
SDK works as expected (terminal command:dev_appserver.py --log_level=warning app.yaml
).The problem is that when I deploy it to the live GAE service (
gcloud app deploy app.yaml --project myapp
), I get a 404 error message:The page could not be found No web page found for the web address: xxx HTTP ERROR 404
The app.yaml looks like this:
runtime: php55 api_version: 1 threadsafe: true skip_files: - README.md - package.json handlers: - url: /(.*\.html) script: mod_rewrite.php secure: always - url: /(.*\..{2,}) static_files: \1 upload: (.*\..{2,}) secure: always - url: /.* script: mod_rewrite.php secure: always
I'va also tried to add a test handler pointing to a specific file:
- url: /(mytest\.html) static_files: \1 upload: mytest.html secure: always
In this way I was able to reach the url. But that was it. Any other url is 404.
An interesting thing is that on the
Versions
tab of the GAE app in the current deployed version it states that the app is0 B
, even if there are no previous versions of it, while it should be around 30 Mb. When deploying, all 988 files seems to be uploaded, also because due to my slow internet connection it takes a while.I have tried to redeploy the whole thing to a new project, after successfully completing the tutorial, and I still encounter the same problem.
解决方案You can use the
application_readable
handler option to include the respective static files in the app code as well. From Handlers element:application_readable
Optional. Boolean. By default, files declared in static file handlers are uploaded as static data and are only served to end users. They cannot be read by an application. If this field is set to true, the files are also uploaded as code data so your application can read them. Both uploads are charged against your code and static data storage resource quotas.
Like this:
- url: /(.*\..{2,}) static_files: \1 upload: (.*\..{2,}) application_readable: true secure: always
这篇关于在使用本地SDK服务器时,在实时Google App Engine上使用404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文