After deploying my first app engine app, I'm receiving Static file referenced by handler not found: index.html
as an error in the logs. Here is my yaml file:
application: section-14
version: v1
api_version: 1
runtime: python27
threadsafe: yes
handlers:
- url: /bower_components
static_dir: bower_components
- url: /general
static_dir: general
- url: /projects
static_dir: projects
- url: /js
static_dir: js
- url: /styles
static_dir: styles
- url: /elements
static_dir: elements
- url: /images
static_dir: images
#here's the problem
- url: /
static_files: index.html
upload: /
#------------------
- url: /elements.html
static_files: elements.html
upload: /
I can travel to any of the other directories, and files located in those directories, without any problem. Also, if you look below the index
entry, the elements.html
route works also.
I noticed in other projects that people are defining a /static
directory. Is that a requirement? My local environment serves this app without any issues as is.
Naming the directory static
isn't a requirement. I do it because it makes the significance of the layout obvious (to me, at least).
Here's an app.yaml
fragment from one of my apps that has a static home page and static assets.
handlers:
- url: /style/
static_dir: static/style
- url: /js/
static_dir: static/js
- url: /favicon.ico
static_files: static/favicon.ico
upload: static/favicon.ico
mime_type: image/x-icon
- url: /.+
script: main.app
- url: /
static_files: static/index.html
upload: static/index.html
The order is significant, as is the use of /.+
instead of /.*
With the latter, requests for /
would get routed to the main.app
Edited to add: Having a url mapping for a static favicon.ico
is useful to prevent the request getting routed to your app, since this'll cause App Engine to spin up an instance when one isn't needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With