Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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 /user/*regex的Google App Engine App.yaml配置_Google App Engine_Python 2.7_App.yaml - Fatal编程技术网

Google app engine /user/*regex的Google App Engine App.yaml配置

Google app engine /user/*regex的Google App Engine App.yaml配置,google-app-engine,python-2.7,app.yaml,Google App Engine,Python 2.7,App.yaml,我正在尝试创建一个登录和配置文件页面。下面是app.yaml文件,它适用于“/”和“/(任何内容)”。我希望路径为“/user/*”,而不是“/(任何内容)”。我尝试了很多,但它只呈现页面的html部分。我如何配置我的app.yaml,使其以完整的CSS和JS呈现,并适用于“/(任何内容)/(任何内容)” PS:我的文件夹树是 app.yaml 静态->CSS、JS、图像、html文件 指数yaml main.app尝试以下方法: - url: /(.+)/(.*\.js) mime_typ

我正在尝试创建一个登录和配置文件页面。下面是app.yaml文件,它适用于“/”和“/(任何内容)”。我希望路径为“/user/*”,而不是“/(任何内容)”。我尝试了很多,但它只呈现页面的html部分。我如何配置我的app.yaml,使其以完整的CSS和JS呈现,并适用于“/(任何内容)/(任何内容)”

PS:我的文件夹树是

app.yaml

静态->CSS、JS、图像、html文件

指数yaml main.app

尝试以下方法:

- url: /(.+)/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2
  upload: static/(.*\.js)
这将匹配
/anythis/file.js
以及
/anythis/anythis/file.js
,以及
/junk/static/hellother/This/matches/everythis/file.js
,因为(++)也匹配所有斜杠。如果不希望两者都匹配,则需要在正则表达式中处理斜杠(分别处理字符和斜杠):

这与
/anything/any\th-ing/file.js
匹配。如果您想更具体,可以使用:

- url: /user/([A-Za-z0-9-_]+)/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2
  upload: static/(.*\.js)
要匹配“/user/anything/file.js”,或:

- url: /([A-Za-z0-9-_]+)/static/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2
  upload: static/(.*\.js)

要匹配
/anything/static/file.js

嘿,伙计,上传参数有什么用?我的意思是现在我正在使用Django,我已经运行collectstatic在一个地方收集所有文件。那么,它是通过gcloud上传的,还是服务器会自动运行该命令?它不工作,你能帮我解决我的问题吗?我在这里发布了一个问题,我已经做了你告诉我的事情,我想问的是app.yaml和static文件夹应该在同一个目录中吗?
- url: /user/([A-Za-z0-9-_]+)/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2
  upload: static/(.*\.js)
- url: /([A-Za-z0-9-_]+)/static/(.*\.js)
  mime_type: text/javascript
  static_files: static/\2
  upload: static/(.*\.js)