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 应用程序引擎可以';找不到静态文件_Google App Engine_Python 2.7_Webapp2 - Fatal编程技术网

Google app engine 应用程序引擎可以';找不到静态文件

Google app engine 应用程序引擎可以';找不到静态文件,google-app-engine,python-2.7,webapp2,Google App Engine,Python 2.7,Webapp2,我在我的应用程序引擎应用程序上使用webapp2和python2.7。但是,app.yaml上的url有问题 我的静态文件位于路径根目录下的static/目录中。所以在static/中,我有static/scripts/MyScript.js 当我将app.yaml设置为: application: myapp version: 1 runtime: python27 threadsafe: true api_version: 1 handlers: - url: /.* script:

我在我的应用程序引擎应用程序上使用webapp2和python2.7。但是,app.yaml上的url有问题

我的静态文件位于路径根目录下的
static/
目录中。所以在
static/
中,我有
static/scripts/MyScript.js

当我将app.yaml设置为:

application: myapp
version: 1
runtime: python27
threadsafe: true
api_version: 1

handlers:
- url: /.*
  script: myapp.app

- url: /static
  static_dir: static

libraries:
- name: webapp2
  version: latest
在我的HTML代码中,js被称为:

但是,文件没有加载,我得到一个404错误。(对于.css文件也会出现此问题。)

但是,如果我将app.yaml中的第一个url更改为:

handlers:
- url: /
  script: myapp.app
静态文件已加载,但当我尝试在我的应用程序中调用routes url时(例如,我在表单中调用url以在服务器上保存一些数据),找不到该路由,我还收到404错误

这是我在myapp.py文件中的路由代码

app = webapp2.WSGIApplication(
                              [('/', MainHandler),
                              ('/save', SaveData),], 
                              debug=True)
因此,如果我尝试访问myapp.appspot.com/save,它会返回404错误,说明:

在此服务器上找不到请求的URL/保存

有什么想法吗?如果你需要更多关于它的信息,只需询问评论


谢谢。

将您的全面url/*放在底部,因为这是按顺序计算的。这意味着它永远不会过去

handlers:
- url: /static
  static_dir: static

- url: /.*
  script: myapp.app