[英]app.yaml / project file structure works on app engine localhost debugger but not on google app engine server
This issue is probably a result of my limited understanding of project structures in Python and app engine as well as my limited understanding of the app.yaml file. 这个问题可能是由于我对Python和app引擎中项目结构的理解有限,以及我对app.yaml文件的理解有限。
I have a python 2.7 project who's file structure looks like this: 我有一个python 2.7项目,其文件结构如下所示:
Project_name > src app.yaml > python __init__.py > package_folder1 __init__.py package1_file.py > package_folder2 __init__.py
My app.yaml file has this in it: 我的app.yaml文件中有这个:
- url: /package1/resource1 script: package_folder1.package1_file1.py secure: always
This works fine when debugging on localhost using app engine's simulator, but on the server, I am getting this warning (which in this case is an error because the script is not being served) when I try to access the resource /package1/resource1
: 这在使用app引擎的模拟器在localhost上调试时工作正常,但在服务器上,当我尝试访问资源/package1/resource1
时,我收到此警告(在这种情况下是一个错误,因为脚本没有被提供):
File referenced by handler not found: python.package_folder1.package1_file1.py
I also tried changing the line in the app.yaml file to this script: package_folder1.package1_file1.py
and still got the same error. 我还尝试将app.yaml文件中的行更改为此script: package_folder1.package1_file1.py
并仍然出现相同的错误。
Any ideas? 有任何想法吗? Thanks! 谢谢!
What runtime are you using python 2.5 or python 2.7? 您使用python 2.5或python 2.7的运行时是什么时候? There are some differences when using one or the other. 使用其中一个时存在一些差异。 Also, where in your project structure are you storing the app.yaml file? 此外,您的项目结构中存储app.yaml文件的位置?
For python 2.5 you specify the actual python script, but for python 2.7 you specify the WSGI application. 对于python 2.5,您指定实际的python脚本,但是对于python 2.7,您指定了WSGI应用程序。 See https://developers.google.com/appengine/docs/python/config/appconfig#Script_Handlers for more details. 有关详细信息,请参阅https://developers.google.com/appengine/docs/python/config/appconfig#Script_Handlers 。
The runtime is defined in the app.yaml file with the key runtime. 运行时在app.yaml文件中使用密钥运行时定义。
runtime: python #python 2.5
runtime: python27 #python 2.7
Is the python folder the entire python runtime? python文件夹是整个python运行时吗? If so, you should not be including that. 如果是这样,你不应该包括那个。
Project_name
> src
app.yaml
> package_folder1
__init__.py
package1_file.py
> package_folder2
__init__.py
Use slashes instead of periods to specify the script in the app.yaml file: 使用斜杠而不是句点来指定app.yaml文件中的脚本:
script: package_folder1/package1_file1.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.