Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine Web2py此应用程序不适用于谷歌应用程序引擎(GAE)_Google App Engine_Web2py - Fatal编程技术网

Google app engine Web2py此应用程序不适用于谷歌应用程序引擎(GAE)

Google app engine Web2py此应用程序不适用于谷歌应用程序引擎(GAE),google-app-engine,web2py,Google App Engine,Web2py,我在谷歌应用服务器(gae)上使用web2py时遇到问题。 在浏览器中插入urllocalhost:8080时出现的错误是: rafael@rafael-debian:~/rafael/google_appengine$ python dev_appserver.py ../web2py/ INFO 2015-03-20 03:38:20,075 sdk_update_checker.py:229] Checking for updates to the SDK. INFO 20

我在谷歌应用服务器(gae)上使用web2py时遇到问题。 在浏览器中插入url
localhost:8080
时出现的错误是:

rafael@rafael-debian:~/rafael/google_appengine$ python dev_appserver.py ../web2py/
INFO     2015-03-20 03:38:20,075 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO     2015-03-20 03:38:20,520 sdk_update_checker.py:257] The SDK is up to date.
INFO     2015-03-20 03:38:21,109 api_server.py:172] Starting API server at: http://localhost:41836
INFO     2015-03-20 03:38:21,202 dispatcher.py:186] Starting module "default" running at: http://localhost:8080
INFO     2015-03-20 03:38:21,203 admin_server.py:118] Starting admin server at: http://localhost:8000
INFO     2015-03-20 03:38:32,968 module.py:737] default: "GET / HTTP/1.1" 404 -
INFO     2015-03-20 03:38:33,172 module.py:737] default: "GET /favicon.ico HTTP/1.1" 404 -
问题出在
app.yaml
中。我基于
app.example.yaml
文件进行了必要的更改,但仍然不起作用

下面是这样的简化结构:目录
web2py
google\u appengine
和文件
app.yaml

web2py/
├── anyserver.py
├── applications
│   ├── admin
│   ├── core
│   ├── examples
│   └── welcome
├── app.yaml
├── handlers
│   ├── cgihandler.py
│   ├── fcgihandler.py
│   ├── gaehandler.py
│   ├── isapiwsgihandler.py
│   ├── modpythonhandler.py
│   ├── README
│   ├── scgihandler.py
│   ├── web2py_on_gevent.py
│   └── wsgihandler.py
├── web2py.py
└── welcome.w2p
│
google_appengine/
├── dev_appserver.py
应用程序yaml

#  For Google App Engine deployment, copy this file to app.yaml
#  and edit as required
#  See http://code.google.com/appengine/docs/python/config/appconfig.html
#  and http://web2py.com/book/default/chapter/11?search=app.yaml

application: core
version: 1
api_version: 1

# use these lines for Python 2.7
# upload app with: appcfg.py update web2py (where 'web2py' is web2py's root directory)
#
runtime: python27
threadsafe: false    # true for WSGI & concurrent requests (Python 2.7 only)

default_expiration: "24h"   # for static files

handlers:

# Warning! Static mapping - below - isn't compatible with 
# the parametric router's language logic. 
# You cannot use them together.

- url: /(.+?)/static/_\d.\d.\d\/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional
  expiration: "365d"

- url: /(.+?)/static/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional

- url: /favicon.ico
  static_files: applications/core/static/favicon.ico
  upload: applications/core/static/favicon.ico

- url: /robots.txt
  static_files: applications/core/static/robots.txt
  upload: applications/welcome/static/robots.txt

- url: .*
  script: handlers/gaehandler.wsgiapp    # WSGI (Python 2.7 only)
  secure: optional

admin_console:
  pages:
  - name: Appstats
    url: /_ah/stats

skip_files: |
 ^(.*/)?(
 (app\.yaml)|
 (app\.yml)|
 (index\.yaml)|
 (index\.yml)|
 (#.*#)|
 (.*~)|
 (.*\.py[co])|
 (.*/RCS/.*)|
 (\..*)|
 (applications/examples/.*)|
 ((examples|welcome)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
 ((logs|scripts)/.*)|
 (anyserver\.py)|
 (web2py\.py)|
 ((cgi|fcgi|modpython|wsgi)handler\.py)|
 (epydoc\.(conf|css))|
 (httpserver\.log)|
 (logging\.example\.conf)|
 (route[rs]\.example\.py)|
 (setup_(app|exe)\.py)|
 (splashlogo\.gif)|
 (parameters_\d+\.py)|
 (options_std.py)|
 (gluon/tests/.*)|
 (gluon/rocket\.py)|
 (contrib/(gateways|markdown|memcache|pymysql)/.*)|
 (contrib/(populate|taskbar_widget)\.py)|
 (google_appengine/.*)|
 (.*\.(bak|orig))|
 )$

builtins:
- remote_api: on
- appstats: on
- admin_redirect: on
- deferred: on
版本: Python 2.7.9; web2py2.9.12; GAE 1.9.18

有人能帮我用谷歌应用引擎运行web2py吗。我已经尝试了所有我已经在论坛和小组中读过的文章,在youtube上看过的视频,但都没有效果。
感谢您的关注

为了解决这个问题,我将参数threadsafe更改为
threadsafe:true
脚本
script:handler/gaehandler.wsgiapp
的脚本
script:gaehandler.wsgiapp
。然后将文件
handlers/gaehandler.py
剪切到上面的目录

app.yaml

#  For Google App Engine deployment, copy this file to app.yaml
#  and edit as required
#  See http://code.google.com/appengine/docs/python/config/appconfig.html
#  and http://web2py.com/book/default/chapter/11?search=app.yaml

application: core
version: 1
api_version: 1

# use these lines for Python 2.7
# upload app with: appcfg.py update web2py (where 'web2py' is web2py's root directory)
#
runtime: python27
threadsafe: true    # true for WSGI & concurrent requests (Python 2.7 only)

default_expiration: "24h"   # for static files

handlers:

# Warning! Static mapping - below - isn't compatible with 
# the parametric router's language logic. 
# You cannot use them together.

- url: /(.+?)/static/_\d.\d.\d\/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional
  expiration: "365d"

- url: /(.+?)/static/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional

- url: /favicon.ico
  static_files: applications/core/static/favicon.ico
  upload: applications/core/static/favicon.ico

- url: /robots.txt
  static_files: applications/core/static/robots.txt
  upload: applications/welcome/static/robots.txt

- url: .*
  script: gaehandler.wsgiapp    # WSGI (Python 2.7 only)
  secure: optional

admin_console:
  pages:
  - name: Appstats
    url: /_ah/stats

skip_files: |
 ^(.*/)?(
 (app\.yaml)|
 (app\.yml)|
 (index\.yaml)|
 (index\.yml)|
 (#.*#)|
 (.*~)|
 (.*\.py[co])|
 (.*/RCS/.*)|
 (\..*)|
 (applications/examples/.*)|
 ((examples|welcome)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
 ((logs|scripts)/.*)|
 (anyserver\.py)|
 (web2py\.py)|
 ((cgi|fcgi|modpython|wsgi)handler\.py)|
 (epydoc\.(conf|css))|
 (httpserver\.log)|
 (logging\.example\.conf)|
 (route[rs]\.example\.py)|
 (setup_(app|exe)\.py)|
 (splashlogo\.gif)|
 (parameters_\d+\.py)|
 (options_std.py)|
 (gluon/tests/.*)|
 (gluon/rocket\.py)|
 (contrib/(gateways|markdown|memcache|pymysql)/.*)|
 (contrib/(populate|taskbar_widget)\.py)|
 (google_appengine/.*)|
 (.*\.(bak|orig))|
 )$

builtins:
- remote_api: on
- appstats: on
- admin_redirect: on
- deferred: on
目录

web2py/
├── anyserver.py
├── applications
│   ├── admin
│   ├── core
│   ├── examples
│   └── welcome
├── app.yaml
├── handlers
│   ├── cgihandler.py
│   ├── fcgihandler.py
│   ├── 
│   ├── isapiwsgihandler.py
│   ├── modpythonhandler.py
│   ├── README
│   ├── scgihandler.py
│   ├── web2py_on_gevent.py
│   └── wsgihandler.py
├── web2py.py
├── gaehandler.py
└── welcome.w2p
│
google_appengine/
├── dev_appserver.py

404问题归结为一行:

script: handlers/gaehandler.wsgiapp
这将目录表示法(即“/”!)与“Python模块表示法”混合在一起,因此(在threadsafe为true的情况下)将在目录
处理程序中查找名为
gaehandler.wsgiapp
的文件

确保
处理程序
目录是一个Python(即它包含一个文件名
\uuuu init\uuuu.py
,通常为空),然后将该行修复为

script: handlers.gaehandler.wsgiapp
看到区别了吗?一个点而不是斜线——仅此而已!)


favicon.ico
上的404是一个单独的问题,应该与您的层次结构中名为
applications/core/static/favicon.ico
的缺失文件相关联——您确实说过您有
applications/core
,但没有它下面的内容(事实上,您在该目录下没有显示任何内容?!)所以我想这是一种可能性(我想不出任何其他原因…。

我正在GAE中运行Web2py:

在web2py.py的同一目录中,您需要:

App.yaml

#对于Google应用程序引擎部署,请将此文件复制到App.yaml
#并根据需要进行编辑
#看http://code.google.com/appengine/docs/python/config/appconfig.html
#及http://web2py.com/book/default/chapter/11?search=app.yaml
应用程序:yourapplicaton
版本:22
api_版本:1
#将这些行用于Python2.7
#上载应用程序:appcfg.py update web2py(其中“web2py”是web2py的根目录)
#
运行时:python27
threadsafe:true#适用于WSGI和并发请求(仅限Python 2.7)
默认_过期时间:静态文件为“24小时”
处理程序:
#警告!下面的静态映射与不兼容
#参数化路由器的语言逻辑。
#不能同时使用它们。
-url:/(.+?)/static/\ud\d\d\/(.+)
静态\u文件:应用程序/\1/static/\2
上传:应用程序/(.+?)/静态/(.+)
安全:可选
有效期:“365d”
-url:/(.+?)/静态/(.+)
静态\u文件:应用程序/\1/static/\2
上传:应用程序/(.+?)/静态/(.+)
安全:可选
-url:/favicon.ico
静态文件:applications/init/static/favicon.ico
上传:applications/init/static/favicon.ico
-url:/robots.txt
静态_文件:applications/init/static/robots.txt
上传:applications/init/static/robots.txt
-url:*
脚本:gaehandler.wsgiapp#WSGI(仅限Python 2.7)
安全:可选
#所有以/样式表开头的URL都被视为中静态文件的路径
#样式表/目录。
-url:/init/static/css/
静态目录:applications/init/static/css
mime_类型:“文本/css”
-url:/init/static/
静态目录:应用程序/init/static
mime_类型:“文本/css”
-url:/init/static/js/
静态目录:applications/init/static/js
mime_类型:“文本/javascript”
管理控制台:
页:
-名称:Appstats
url:/\u ah/stats
跳过\u文件:|
^(.*/)?(
(app\.yaml)|
(app\.yml)|
(索引\.yaml)|
(索引\.yml)|
(#.*#)|
(.*~)|
(.\.py[co])|
(.*/RCS/*)|
(\..*)|
(应用程序/示例/*)|
((示例欢迎)\(w2p焦油)|
(应用程序/*?/(cron |数据库|错误|缓存|会话)/.*)|
((日志|脚本)/.*)|
(anyserver\.py)|
(web2py\.py)|
((cgi | fcgi | modpython | wsgi)handler\.py)|
(epydoc\(形态| css))|
(httpserver\.log)|
(记录\.example\.conf)|
(路线[rs]\.example\.py)|
(安装程序(app | exe)\.py)|
(splashlogo\.gif)|
(参数\ud+\.py)|
(选项标准py)|
(胶子/测试/*)|
(胶子/火箭\.py)|
(contrib/(gateways | markdown | memcache | pymysql)/.*)|
(contrib/(填充任务栏小部件)\.py)|
(谷歌appengine/*)|
(.\.(bak|orig))|
)$
内置:
-远程应用程序接口:打开
-appstats:on
-管理员重定向:打开

-延迟:在
上,除了“它不工作”之外,还有什么实际问题?当我在浏览器“localhost:8080”中输入数字时,返回错误404,我会将你的app.yaml简化为一个可以工作的条目,然后从中获取。你可以演示如何执行此操作吗?