Reputation: 2014
I recently deployed a website for my dad using Google App Engine.
Oddly, some images in the gallery are found, while some return with a 404. I looked in the admin dashboard for usage rates, and it says I'm only at 17% of "Code and Static File Storage".
I have tried changing the directory and re-deploying, I have also created a second application (from this-site-1 to this-site-2), and I have waited about an hour in case it's simply the cache, but none of these seem to be the issue.
I'm brand new to Google App Engine, this is the first website I've deployed using it, so any help would be much appreciated.
app.yaml
application: this-site-2
version: 1
runtime: python
threadsafe: true
api_version: 1
handlers:
- url: /robots.txt
static_files: static/robots.txt
upload: static/robots.txt
- url: /css
static_dir: static/css
- url: /img
static_dir: static/img
- url: /js
static_dir: static/js
- url: /.*
script: main.py
Edit: I updated python to 2.7 in case that was the problem, but I did by doing this:
application: this-site-2
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /robots.txt
static_files: static/robots.txt
upload: static/robots.txt
- url: /css
static_dir: static/css
- url: /img
static_dir: static/img
- url: /js
static_dir: static/js
- url: /.*
script: main.app # a WSGI application in the main module's global scope
libraries:
- name: webapp2
version: "2.5.1"
- name: django
version: "1.2"
skip_files:
- ^(.*/)?app\.yaml
- ^(.*/)?app\.yml
- ^(.*/)?index\.yaml
- ^(.*/)?index\.yml
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^(.*/)?.*\.bak$
- ^(.*/)?.*\.less$
Then I deployed, and the console said that the deployment was successful and it was updating the indexes and exited with code 0. Then I tried to go to the website and it returned with a 500 server error
. So I downgraded back to python 2.5 and the site is fine.
Upvotes: 0
Views: 204
Reputation: 436
I had this problem and it turned out that it deploying images with lower case file extensions like this: name.png
, but not ones with capital file extensions like this: name.PNG
. Helpfully Windows hides this from you, so you can't always tell.
Upvotes: 1
Reputation: 2014
Ah, my dad solved it;
Simply change the jpg
images that aren't working to a png
image (and vice versa, if it's a png
image not working, convert it to a jpg
)
Upvotes: 0
Reputation: 1839
I think your image url handler is more complicated than it needs to be. I would suggest:
static
or similar with subfolders for images, Javascript and CSS.Use the following handler instead of your current image handler:
handlers:
- url: /images
static_dir: static/images
All files in the static/images
folder will then be accessible on the url yourwebsite.com/images/subpath/image.jpg
.
For more inspiration, see this app.yaml
.
Upvotes: 3