gpt4 book ai didi

python - 图像在本地工作,但部署到 Google App Engine 后就无法工作?

转载 作者:行者123 更新时间:2023-12-01 05:46:14 24 4
gpt4 key购买 nike

我有一个 app.yaml 文件,如下所示:

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

handlers:
- url: /css
static_dir: css

- url: /img(.*\.(gif|png|jpg))
static_files: img/\1
upload: img(.*\.(gif|png|jpg))

- url: /
script: index.app

skip_files:
- ^(.*/)?app\.yaml
- ^(.*/)?app\.yml
- ^(.*/)?index\.yaml
- ^(.*/)?index\.yml
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^(.*/)?dev
- ^(.*/)?old_ver
- ^(.*/)?resources

图像在本地都显示良好。然而,一旦部署,它们就会显示为损坏的。

html中的图片设置如下:

<img src="/img/welcomeimg.png">

部署时图像是否未上传?这是什么原因造成的? css 文件夹似乎部署没有问题。

最佳答案

urlupload 部分的 img 末尾添加斜杠:

- url: /img/(.*\.(gif|png|jpg))
static_files: img/\1
upload: img/(.*\.(gif|png|jpg))

关于python - 图像在本地工作,但部署到 Google App Engine 后就无法工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16029865/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com