Create a gist now

Instantly share code, notes, and snippets.

Embed
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces

App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be necessary for most situations.

my_site
  app.yaml
  static
    index.html
    ...

The static folder is invisible when serving (i.e. my_site/static/index.html is accessed as http://your-app-name-here.appspot.com/index.html.

Remember: No spaces in file or path names. Case sensitive.

application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
static_files: static/\1
upload: static/(.*\.(appcache|manifest))
expiration: "0m"
- url: /(.*\.atom)
mime_type: application/atom+xml
static_files: static/\1
upload: static/(.*\.atom)
expiration: "1h"
- url: /(.*\.crx)
mime_type: application/x-chrome-extension
static_files: static/\1
upload: static/(.*\.crx)
- url: /(.*\.css)
mime_type: text/css
static_files: static/\1
upload: static/(.*\.css)
- url: /(.*\.eot)
mime_type: application/vnd.ms-fontobject
static_files: static/\1
upload: static/(.*\.eot)
- url: /(.*\.htc)
mime_type: text/x-component
static_files: static/\1
upload: static/(.*\.htc)
- url: /(.*\.html)
mime_type: text/html
static_files: static/\1
upload: static/(.*\.html)
expiration: "1h"
- url: /(.*\.ico)
mime_type: image/x-icon
static_files: static/\1
upload: static/(.*\.ico)
expiration: "7d"
- url: /(.*\.js)
mime_type: text/javascript
static_files: static/\1
upload: static/(.*\.js)
- url: /(.*\.json)
mime_type: application/json
static_files: static/\1
upload: static/(.*\.json)
expiration: "1h"
- url: /(.*\.m4v)
mime_type: video/m4v
static_files: static/\1
upload: static/(.*\.m4v)
- url: /(.*\.mp4)
mime_type: video/mp4
static_files: static/\1
upload: static/(.*\.mp4)
- url: /(.*\.(ogg|oga))
mime_type: audio/ogg
static_files: static/\1
upload: static/(.*\.(ogg|oga))
- url: /(.*\.ogv)
mime_type: video/ogg
static_files: static/\1
upload: static/(.*\.ogv)
- url: /(.*\.otf)
mime_type: font/opentype
static_files: static/\1
upload: static/(.*\.otf)
- url: /(.*\.rss)
mime_type: application/rss+xml
static_files: static/\1
upload: static/(.*\.rss)
expiration: "1h"
- url: /(.*\.safariextz)
mime_type: application/octet-stream
static_files: static/\1
upload: static/(.*\.safariextz)
- url: /(.*\.(svg|svgz))
mime_type: images/svg+xml
static_files: static/\1
upload: static/(.*\.(svg|svgz))
- url: /(.*\.swf)
mime_type: application/x-shockwave-flash
static_files: static/\1
upload: static/(.*\.swf)
- url: /(.*\.ttf)
mime_type: font/truetype
static_files: static/\1
upload: static/(.*\.ttf)
- url: /(.*\.txt)
mime_type: text/plain
static_files: static/\1
upload: static/(.*\.txt)
- url: /(.*\.unity3d)
mime_type: application/vnd.unity
static_files: static/\1
upload: static/(.*\.unity3d)
- url: /(.*\.webm)
mime_type: video/webm
static_files: static/\1
upload: static/(.*\.webm)
- url: /(.*\.webp)
mime_type: image/webp
static_files: static/\1
upload: static/(.*\.webp)
- url: /(.*\.woff)
mime_type: application/x-font-woff
static_files: static/\1
upload: static/(.*\.woff)
- url: /(.*\.xml)
mime_type: application/xml
static_files: static/\1
upload: static/(.*\.xml)
expiration: "1h"
- url: /(.*\.xpi)
mime_type: application/x-xpinstall
static_files: static/\1
upload: static/(.*\.xpi)
# image files
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
static_files: static/\1
upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
# audio files
- url: /(.*\.(mid|midi|mp3|wav))
static_files: static/\1
upload: static/(.*\.(mid|midi|mp3|wav))
# windows files
- url: /(.*\.(doc|exe|ppt|rtf|xls))
static_files: static/\1
upload: static/(.*\.(doc|exe|ppt|rtf|xls))
# compressed files
- url: /(.*\.(bz2|gz|rar|tar|tgz|zip))
static_files: static/\1
upload: static/(.*\.(bz2|gz|rar|tar|tgz|zip))
# index files
- url: /(.+)/
static_files: static/\1/index.html
upload: static/(.+)/index.html
expiration: "15m"
- url: /(.+)
static_files: static/\1/index.html
upload: static/(.+)/index.html
expiration: "15m"
# site root
- url: /
static_files: static/index.html
upload: static/index.html
expiration: "15m"
@bbalegere

This comment has been minimized.

Show comment
Hide comment
@bbalegere

bbalegere Oct 23, 2011

Thanks.
however mypp.appspot.com/about gives an error.
i have to include the trailing slash
mypp.appspot.com/about/

Is there any way to fix this?

Thanks.
however mypp.appspot.com/about gives an error.
i have to include the trailing slash
mypp.appspot.com/about/

Is there any way to fix this?

@rotaryden

This comment has been minimized.

Show comment
Hide comment
@rotaryden

rotaryden Dec 1, 2011

Hi bbalegere,

you need to place ? mark after last slash, it makes it optional:

# index files
- url: /(.*)/?
  static_files: static/\1/index.html
  upload: static/(.*)/index.html
  expiration: "15m"

Hi bbalegere,

you need to place ? mark after last slash, it makes it optional:

# index files
- url: /(.*)/?
  static_files: static/\1/index.html
  upload: static/(.*)/index.html
  expiration: "15m"
@darktable

This comment has been minimized.

Show comment
Hide comment
@darktable

darktable Dec 1, 2011

@altitudebreath - Nice one character fix. Thanks.

Owner

darktable commented Dec 1, 2011

@altitudebreath - Nice one character fix. Thanks.

@bbalegere

This comment has been minimized.

Show comment
Hide comment
@bbalegere

bbalegere Dec 4, 2011

There is another problem.
mypp.appspot.com/about this works fine.
but mypp.appspot.com/about/ this does not.Any way to make both kinds of urls to work properly?
The url should open properly with or without trailing slash.

There is another problem.
mypp.appspot.com/about this works fine.
but mypp.appspot.com/about/ this does not.Any way to make both kinds of urls to work properly?
The url should open properly with or without trailing slash.

@darktable

This comment has been minimized.

Show comment
Hide comment
@darktable

darktable Dec 4, 2011

okay, should work both ways now.

Owner

darktable commented Dec 4, 2011

okay, should work both ways now.

@bbalegere

This comment has been minimized.

Show comment
Hide comment
@bbalegere

bbalegere Dec 4, 2011

Its working both ways now.But there is a problem when you click on a link in a page opened without the trailing slash.

If you open mypp.appspot.com/about and that page has link to a sub page,then it does not open.
The html code in the about page is like this

<a href="subpage/">subpage</a>

When a user clicks on it, mypp.appspot.com/subpage/ is opened instead of mypp.appspot.com/about/subpage/ .

However when the about page is accessed with the trailing slash , mypp.appspot.com/about/ , then mypp.appspot.com/about/subpage/ opens correctly when the link is clicked.

Its working both ways now.But there is a problem when you click on a link in a page opened without the trailing slash.

If you open mypp.appspot.com/about and that page has link to a sub page,then it does not open.
The html code in the about page is like this

<a href="subpage/">subpage</a>

When a user clicks on it, mypp.appspot.com/subpage/ is opened instead of mypp.appspot.com/about/subpage/ .

However when the about page is accessed with the trailing slash , mypp.appspot.com/about/ , then mypp.appspot.com/about/subpage/ opens correctly when the link is clicked.

@mica

This comment has been minimized.

Show comment
Hide comment
@mica

mica Feb 27, 2012

Thanks for this. You just saved me a lot of trouble.

You might want to add:

- url: /(.*\.pdf)
  mime_type: application/pdf
  static_files: static/\1
  upload: static/(.*\.pdf)

mica commented Feb 27, 2012

Thanks for this. You just saved me a lot of trouble.

You might want to add:

- url: /(.*\.pdf)
  mime_type: application/pdf
  static_files: static/\1
  upload: static/(.*\.pdf)
@ahmedmurtaza

This comment has been minimized.

Show comment
Hide comment
@ahmedmurtaza

ahmedmurtaza Feb 29, 2012

tnx buddy
but would you tell me how to ulpoad php files????

tnx buddy
but would you tell me how to ulpoad php files????

@mica

This comment has been minimized.

Show comment
Hide comment
@mica

mica Feb 29, 2012

GAE doesn't host PHP.

mica commented Feb 29, 2012

GAE doesn't host PHP.

@ahmedmurtaza

This comment has been minimized.

Show comment
Hide comment
@ahmedmurtaza

ahmedmurtaza Mar 2, 2012

is there any way to convert php in js?

is there any way to convert php in js?

@balajeerc

This comment has been minimized.

Show comment
Hide comment
@balajeerc

balajeerc Apr 24, 2012

The yaml works perfectly. However, I would like to create a url handler for my scripts. For eg. is it possible to map /app to my script main.py?

The yaml works perfectly. However, I would like to create a url handler for my scripts. For eg. is it possible to map /app to my script main.py?

@darktable

This comment has been minimized.

Show comment
Hide comment
@darktable

darktable Apr 24, 2012

If you put your "/app" handler before the wildcard handlers "/(.+)/" (around line 170), it should work.

Owner

darktable commented Apr 24, 2012

If you put your "/app" handler before the wildcard handlers "/(.+)/" (around line 170), it should work.

@Dandu-Venkata-Ravi-Varma

This comment has been minimized.

Show comment
Hide comment
@Dandu-Venkata-Ravi-Varma

Dandu-Venkata-Ravi-Varma Aug 8, 2012

For some reason images don't seem to load anymore, although they did with:

application: myApp
version: 1
runtime: python
api_version: 1

handlers:
# Accessing URL '/' on the site should show the public/index.html file
- url: /
  static_files: public/index.html
  upload: public/index.html

# Accessing anything under '/' (i.e. any URL at all) should return that page from folder public 
- url: /
  static_dir: public```

For some reason images don't seem to load anymore, although they did with:

application: myApp
version: 1
runtime: python
api_version: 1

handlers:
# Accessing URL '/' on the site should show the public/index.html file
- url: /
  static_files: public/index.html
  upload: public/index.html

# Accessing anything under '/' (i.e. any URL at all) should return that page from folder public 
- url: /
  static_dir: public```
@delro92

This comment has been minimized.

Show comment
Hide comment
@delro92

delro92 Sep 22, 2012

Is there a way to display 404 pages?

delro92 commented Sep 22, 2012

Is there a way to display 404 pages?

@lipis

This comment has been minimized.

Show comment
Hide comment
@lipis

lipis Dec 31, 2013

For ttf I think it's better to use the application/x-font-ttf instead of font/truetype

https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess#L148

lipis commented Dec 31, 2013

For ttf I think it's better to use the application/x-font-ttf instead of font/truetype

https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess#L148

@andlord

This comment has been minimized.

Show comment
Hide comment
@andlord

andlord Feb 19, 2014

Thanks a lot !!!!!!! very helpful !!!!!

andlord commented Feb 19, 2014

Thanks a lot !!!!!!! very helpful !!!!!

@GokulPraveenB

This comment has been minimized.

Show comment
Hide comment
@GokulPraveenB

GokulPraveenB Jun 12, 2014

Very helpful ! .. but , images didnt work without mime types

instead of

  • url: /(..(bmp|gif|ico|jpeg|jpg|png))

    static_files: static/\1

    upload: static/(.
    .(bmp|gif|ico|jpeg|jpg|png))

i replaced with this .. It worked only after i added separate mime types like

  • url: /(..png)

    mime_type: image/png

    static_files: static/\1

    upload: static/(.
    .png)

can you let me know it didnt work regularly for me alone .. am using python 2.7

Very helpful ! .. but , images didnt work without mime types

instead of

  • url: /(..(bmp|gif|ico|jpeg|jpg|png))

    static_files: static/\1

    upload: static/(.
    .(bmp|gif|ico|jpeg|jpg|png))

i replaced with this .. It worked only after i added separate mime types like

  • url: /(..png)

    mime_type: image/png

    static_files: static/\1

    upload: static/(.
    .png)

can you let me know it didnt work regularly for me alone .. am using python 2.7

@noahwc

This comment has been minimized.

Show comment
Hide comment
@noahwc

noahwc Jun 29, 2014

Why are certain file types handled on their own (.txt) with mime types and others are handled together ((bmp|gif|ico|jpeg|jpg|png))

noahwc commented Jun 29, 2014

Why are certain file types handled on their own (.txt) with mime types and others are handled together ((bmp|gif|ico|jpeg|jpg|png))

@louischan

This comment has been minimized.

Show comment
Hide comment
@louischan

louischan Jul 25, 2014

Mime type for svg should be image/svg+xml instead of images/svg+xml

Mime type for svg should be image/svg+xml instead of images/svg+xml

@aweiand

This comment has been minimized.

Show comment
Hide comment
@aweiand

aweiand Jul 30, 2014

What I do for sending email with GAE?
Thanks.

aweiand commented Jul 30, 2014

What I do for sending email with GAE?
Thanks.

@thekondrashov

This comment has been minimized.

Show comment
Hide comment
@thekondrashov

thekondrashov Aug 20, 2014

Here are the official MIME types for Web Fonts:

.eot -> application/vnd.ms-fontobject (as from December 2005) (gzip disabled)
.otf -> application/font-sfnt (as from March 2013) (gzip disabled)
.svg -> image/svg+xml (as from August 2011) (gzip enabled)
.ttf -> application/font-sfnt (as from March 2013) (gzip disabled, but GAE support ttf-fonts gzip with mime type "font/ttf")
.woff -> application/font-woff (as from January 2013) (already gzip compressed)

http://stackoverflow.com/questions/2871655/proper-mime-type-for-fonts#20723357

MIME types from MaxCDN (for example FontAwesome):
.eot -> application/vnd.ms-fontobject
.otf -> application/octet-stream
.svg -> image/svg+xml
.ttf -> font/ttf
.woff -> application/font-woff

/ sorry for my English /

Here are the official MIME types for Web Fonts:

.eot -> application/vnd.ms-fontobject (as from December 2005) (gzip disabled)
.otf -> application/font-sfnt (as from March 2013) (gzip disabled)
.svg -> image/svg+xml (as from August 2011) (gzip enabled)
.ttf -> application/font-sfnt (as from March 2013) (gzip disabled, but GAE support ttf-fonts gzip with mime type "font/ttf")
.woff -> application/font-woff (as from January 2013) (already gzip compressed)

http://stackoverflow.com/questions/2871655/proper-mime-type-for-fonts#20723357

MIME types from MaxCDN (for example FontAwesome):
.eot -> application/vnd.ms-fontobject
.otf -> application/octet-stream
.svg -> image/svg+xml
.ttf -> font/ttf
.woff -> application/font-woff

/ sorry for my English /

@kumarjatin

This comment has been minimized.

Show comment
Hide comment
@kumarjatin

kumarjatin Sep 27, 2014

The order of url specifications is crucial! Make sure any other url handler rule doesn't interfere with your static handler rule and comes before that.

Like this works

- url: /static
  static_dir : static
- url: .*
  script: main.py
  secure: always

but this doesn't

- url: .*
  script: main.py
  secure: always
- url: /static
  static_dir : static

The order of url specifications is crucial! Make sure any other url handler rule doesn't interfere with your static handler rule and comes before that.

Like this works

- url: /static
  static_dir : static
- url: .*
  script: main.py
  secure: always

but this doesn't

- url: .*
  script: main.py
  secure: always
- url: /static
  static_dir : static
@jasonwbarnett

This comment has been minimized.

Show comment
Hide comment
@jasonwbarnett

jasonwbarnett May 28, 2015

Thank you very much... I can't tell you how awful their (Google App Engine) documentation is and this cleared things up.

Thank you very much... I can't tell you how awful their (Google App Engine) documentation is and this cleared things up.

@MaxLaumeister

This comment has been minimized.

Show comment
Hide comment
@MaxLaumeister

MaxLaumeister Jul 2, 2015

In the config, the svg directive has an incorrect mime_type. Here is the current version:

- url: /(.*\.(svg|svgz))
  mime_type: images/svg+xml
  static_files: static/\1
  upload: static/(.*\.(svg|svgz))

Here is what it needs to be:

- url: /(.*\.(svg|svgz))
  mime_type: image/svg+xml
  static_files: static/\1
  upload: static/(.*\.(svg|svgz))

Was running into an issue where SVGs weren't loading in my pages! Otherwise, thank you for this gist, it's been very helpful for hosting static files on app engine.

In the config, the svg directive has an incorrect mime_type. Here is the current version:

- url: /(.*\.(svg|svgz))
  mime_type: images/svg+xml
  static_files: static/\1
  upload: static/(.*\.(svg|svgz))

Here is what it needs to be:

- url: /(.*\.(svg|svgz))
  mime_type: image/svg+xml
  static_files: static/\1
  upload: static/(.*\.(svg|svgz))

Was running into an issue where SVGs weren't loading in my pages! Otherwise, thank you for this gist, it's been very helpful for hosting static files on app engine.

@pallavJha

This comment has been minimized.

Show comment
Hide comment
@pallavJha

pallavJha Feb 16, 2016

Hi, I have created a webapp using java and there are three app.yaml files in my target folder, so which one do I have to edit?
pkjustpj@tempinitial:~/ImgUploadImg/webapp/target$ tree
.
+-- appengine-staging
¦ +-- app.yaml
¦ +-- index.jsp
¦ +-- static
¦ ¦ +-- static-resources
¦ ¦ ...
¦ +-- static-resources
¦ ¦ ...
¦ +-- WEB-INF
¦ +-- appengine-generated
¦ ¦ +-- app.yaml
¦ +-- appengine-web.xml
¦ +-- classes
¦ ¦ +-- jetty-config.xml
¦ ¦ +-- logback.xml
¦ ¦ +-- spring-config
¦ ¦ +-- spring-context.xml
¦ +-- layouts
¦ ¦ +-- layout.xml
¦ +-- lib
¦ ¦ ...
¦ +-- web.xml
+-- classes
¦ +-- jetty-config.xml
¦ +-- logback.xml
¦ +-- pl
¦ ¦ ...
¦ +-- property-files
¦ ¦ +-- config-info.properties
¦ +-- spring-config
¦ +-- spring-context.xml
+-- generated-sources
¦ +-- annotations
+-- maven-archiver
¦ +-- pom.properties
+-- webapp
¦ +-- app.yaml
¦ +-- index.jsp
¦ +-- META-INF
¦ +-- static-resources
¦ ¦ ...
¦ +-- WEB-INF
¦ ...
+-- webapp.war

Also, my main problem is 404 on all other files(like .css .png. .js .ico) which are present in the static-resources which is a sibling of WEB-INF folder. I have also put on a question on stack-overflow. Kindly help me out. Thanks

http://stackoverflow.com/questions/35356212/404-for-all-the-files-residing-in-static-resources?noredirect=1#comment58501122_35356212

Hi, I have created a webapp using java and there are three app.yaml files in my target folder, so which one do I have to edit?
pkjustpj@tempinitial:~/ImgUploadImg/webapp/target$ tree
.
+-- appengine-staging
¦ +-- app.yaml
¦ +-- index.jsp
¦ +-- static
¦ ¦ +-- static-resources
¦ ¦ ...
¦ +-- static-resources
¦ ¦ ...
¦ +-- WEB-INF
¦ +-- appengine-generated
¦ ¦ +-- app.yaml
¦ +-- appengine-web.xml
¦ +-- classes
¦ ¦ +-- jetty-config.xml
¦ ¦ +-- logback.xml
¦ ¦ +-- spring-config
¦ ¦ +-- spring-context.xml
¦ +-- layouts
¦ ¦ +-- layout.xml
¦ +-- lib
¦ ¦ ...
¦ +-- web.xml
+-- classes
¦ +-- jetty-config.xml
¦ +-- logback.xml
¦ +-- pl
¦ ¦ ...
¦ +-- property-files
¦ ¦ +-- config-info.properties
¦ +-- spring-config
¦ +-- spring-context.xml
+-- generated-sources
¦ +-- annotations
+-- maven-archiver
¦ +-- pom.properties
+-- webapp
¦ +-- app.yaml
¦ +-- index.jsp
¦ +-- META-INF
¦ +-- static-resources
¦ ¦ ...
¦ +-- WEB-INF
¦ ...
+-- webapp.war

Also, my main problem is 404 on all other files(like .css .png. .js .ico) which are present in the static-resources which is a sibling of WEB-INF folder. I have also put on a question on stack-overflow. Kindly help me out. Thanks

http://stackoverflow.com/questions/35356212/404-for-all-the-files-residing-in-static-resources?noredirect=1#comment58501122_35356212

@Forfeit

This comment has been minimized.

Show comment
Hide comment
@Forfeit

Forfeit Mar 25, 2016

I just deployed a website for testing on Google Appengine. Using google App Engine Launcher Its successfully done.

Now I tried to open the deployed website, please check here https://acuteservice-1260.appspot.com the internal pages are not opening.

Below is my APP YAML file its showing warning, I have all files are in php

application: acuteservice-1260
version: 1
runtime: python
api_version: 1

default_expiration: "30d"

handlers:

  • url: /(..(appcache|manifest))
    mime_type: text/cache-manifest
    static_files: static/\1
    upload: static/(.
    .(appcache|manifest))
    expiration: "0m"
  • url: /(..atom)
    mime_type: application/atom+xml
    static_files: static/\1
    upload: static/(.
    .atom)
    expiration: "1h"
  • url: /(..crx)
    mime_type: application/x-chrome-extension
    static_files: static/\1
    upload: static/(.
    .crx)
  • url: /(..css)
    mime_type: text/css
    static_files: static/\1
    upload: static/(.
    .css)
  • url: /(..eot)
    mime_type: application/vnd.ms-fontobject
    static_files: static/\1
    upload: static/(.
    .eot)
  • url: /(..htc)
    mime_type: text/x-component
    static_files: static/\1
    upload: static/(.
    .htc)
  • url: /(..php)
    mime_type: text/html
    static_files: static/\1
    upload: static/(.
    .php)
    expiration: "1h"
  • url: /(..ico)
    mime_type: image/x-icon
    static_files: static/\1
    upload: static/(.
    .ico)
    expiration: "7d"
  • url: /(..js)
    mime_type: text/javascript
    static_files: static/\1
    upload: static/(.
    .js)
  • url: /(..json)
    mime_type: application/json
    static_files: static/\1
    upload: static/(.
    .json)
    expiration: "1h"
  • url: /(..m4v)
    mime_type: video/m4v
    static_files: static/\1
    upload: static/(.
    .m4v)
  • url: /(..mp4)
    mime_type: video/mp4
    static_files: static/\1
    upload: static/(.
    .mp4)
  • url: /(..(ogg|oga))
    mime_type: audio/ogg
    static_files: static/\1
    upload: static/(.
    .(ogg|oga))
  • url: /(..ogv)
    mime_type: video/ogg
    static_files: static/\1
    upload: static/(.
    .ogv)
  • url: /(..otf)
    mime_type: font/opentype
    static_files: static/\1
    upload: static/(.
    .otf)
  • url: /(..rss)
    mime_type: application/rss+xml
    static_files: static/\1
    upload: static/(.
    .rss)
    expiration: "1h"
  • url: /(..safariextz)
    mime_type: application/octet-stream
    static_files: static/\1
    upload: static/(.
    .safariextz)
  • url: /(..(svg|svgz))
    mime_type: images/svg+xml
    static_files: static/\1
    upload: static/(.
    .(svg|svgz))
  • url: /(..swf)
    mime_type: application/x-shockwave-flash
    static_files: static/\1
    upload: static/(.
    .swf)
  • url: /(..ttf)
    mime_type: font/truetype
    static_files: static/\1
    upload: static/(.
    .ttf)
  • url: /(..txt)
    mime_type: text/plain
    static_files: static/\1
    upload: static/(.
    .txt)
  • url: /(..unity3d)
    mime_type: application/vnd.unity
    static_files: static/\1
    upload: static/(.
    .unity3d)
  • url: /(..webm)
    mime_type: video/webm
    static_files: static/\1
    upload: static/(.
    .webm)
  • url: /(..webp)
    mime_type: image/webp
    static_files: static/\1
    upload: static/(.
    .webp)
  • url: /(..woff)
    mime_type: application/x-font-woff
    static_files: static/\1
    upload: static/(.
    .woff)
  • url: /(..xml)
    mime_type: application/xml
    static_files: static/\1
    upload: static/(.
    .xml)
    expiration: "1h"
  • url: /(..xpi)
    mime_type: application/x-xpinstall
    static_files: static/\1
    upload: static/(.
    .xpi)

image files

  • url: /(..(bmp|gif|ico|jpeg|jpg|png))
    static_files: static/\1
    upload: static/(.
    .(bmp|gif|ico|jpeg|jpg|png))

audio files

  • url: /(..(mid|midi|mp3|wav))
    static_files: static/\1
    upload: static/(.
    .(mid|midi|mp3|wav))

windows files

  • url: /(..(doc|exe|ppt|rtf|xls))
    static_files: static/\1
    upload: static/(.
    .(doc|exe|ppt|rtf|xls))

compressed files

  • url: /(..(bz2|gz|rar|tar|tgz|zip))
    static_files: static/\1
    upload: static/(.
    .(bz2|gz|rar|tar|tgz|zip))

index files

  • url: /(.+)/
    static_files: static/\1/index.php
    upload: static/(.+)/index.php
    expiration: "15m"
  • url: /(.+)
    static_files: static/\1/index.php
    upload: static/(.+)/index.php
    expiration: "15m"

site root

  • url: /
    static_files: static/index.php
    upload: static/index.php
    expiration: "15m"
  • url: .*
    script: index.php

Forfeit commented Mar 25, 2016

I just deployed a website for testing on Google Appengine. Using google App Engine Launcher Its successfully done.

Now I tried to open the deployed website, please check here https://acuteservice-1260.appspot.com the internal pages are not opening.

Below is my APP YAML file its showing warning, I have all files are in php

application: acuteservice-1260
version: 1
runtime: python
api_version: 1

default_expiration: "30d"

handlers:

  • url: /(..(appcache|manifest))
    mime_type: text/cache-manifest
    static_files: static/\1
    upload: static/(.
    .(appcache|manifest))
    expiration: "0m"
  • url: /(..atom)
    mime_type: application/atom+xml
    static_files: static/\1
    upload: static/(.
    .atom)
    expiration: "1h"
  • url: /(..crx)
    mime_type: application/x-chrome-extension
    static_files: static/\1
    upload: static/(.
    .crx)
  • url: /(..css)
    mime_type: text/css
    static_files: static/\1
    upload: static/(.
    .css)
  • url: /(..eot)
    mime_type: application/vnd.ms-fontobject
    static_files: static/\1
    upload: static/(.
    .eot)
  • url: /(..htc)
    mime_type: text/x-component
    static_files: static/\1
    upload: static/(.
    .htc)
  • url: /(..php)
    mime_type: text/html
    static_files: static/\1
    upload: static/(.
    .php)
    expiration: "1h"
  • url: /(..ico)
    mime_type: image/x-icon
    static_files: static/\1
    upload: static/(.
    .ico)
    expiration: "7d"
  • url: /(..js)
    mime_type: text/javascript
    static_files: static/\1
    upload: static/(.
    .js)
  • url: /(..json)
    mime_type: application/json
    static_files: static/\1
    upload: static/(.
    .json)
    expiration: "1h"
  • url: /(..m4v)
    mime_type: video/m4v
    static_files: static/\1
    upload: static/(.
    .m4v)
  • url: /(..mp4)
    mime_type: video/mp4
    static_files: static/\1
    upload: static/(.
    .mp4)
  • url: /(..(ogg|oga))
    mime_type: audio/ogg
    static_files: static/\1
    upload: static/(.
    .(ogg|oga))
  • url: /(..ogv)
    mime_type: video/ogg
    static_files: static/\1
    upload: static/(.
    .ogv)
  • url: /(..otf)
    mime_type: font/opentype
    static_files: static/\1
    upload: static/(.
    .otf)
  • url: /(..rss)
    mime_type: application/rss+xml
    static_files: static/\1
    upload: static/(.
    .rss)
    expiration: "1h"
  • url: /(..safariextz)
    mime_type: application/octet-stream
    static_files: static/\1
    upload: static/(.
    .safariextz)
  • url: /(..(svg|svgz))
    mime_type: images/svg+xml
    static_files: static/\1
    upload: static/(.
    .(svg|svgz))
  • url: /(..swf)
    mime_type: application/x-shockwave-flash
    static_files: static/\1
    upload: static/(.
    .swf)
  • url: /(..ttf)
    mime_type: font/truetype
    static_files: static/\1
    upload: static/(.
    .ttf)
  • url: /(..txt)
    mime_type: text/plain
    static_files: static/\1
    upload: static/(.
    .txt)
  • url: /(..unity3d)
    mime_type: application/vnd.unity
    static_files: static/\1
    upload: static/(.
    .unity3d)
  • url: /(..webm)
    mime_type: video/webm
    static_files: static/\1
    upload: static/(.
    .webm)
  • url: /(..webp)
    mime_type: image/webp
    static_files: static/\1
    upload: static/(.
    .webp)
  • url: /(..woff)
    mime_type: application/x-font-woff
    static_files: static/\1
    upload: static/(.
    .woff)
  • url: /(..xml)
    mime_type: application/xml
    static_files: static/\1
    upload: static/(.
    .xml)
    expiration: "1h"
  • url: /(..xpi)
    mime_type: application/x-xpinstall
    static_files: static/\1
    upload: static/(.
    .xpi)

image files

  • url: /(..(bmp|gif|ico|jpeg|jpg|png))
    static_files: static/\1
    upload: static/(.
    .(bmp|gif|ico|jpeg|jpg|png))

audio files

  • url: /(..(mid|midi|mp3|wav))
    static_files: static/\1
    upload: static/(.
    .(mid|midi|mp3|wav))

windows files

  • url: /(..(doc|exe|ppt|rtf|xls))
    static_files: static/\1
    upload: static/(.
    .(doc|exe|ppt|rtf|xls))

compressed files

  • url: /(..(bz2|gz|rar|tar|tgz|zip))
    static_files: static/\1
    upload: static/(.
    .(bz2|gz|rar|tar|tgz|zip))

index files

  • url: /(.+)/
    static_files: static/\1/index.php
    upload: static/(.+)/index.php
    expiration: "15m"
  • url: /(.+)
    static_files: static/\1/index.php
    upload: static/(.+)/index.php
    expiration: "15m"

site root

  • url: /
    static_files: static/index.php
    upload: static/index.php
    expiration: "15m"
  • url: .*
    script: index.php
@SoulAuctioneer

This comment has been minimized.

Show comment
Hide comment
@SoulAuctioneer

SoulAuctioneer Apr 13, 2017

So why would you do all of that rather than simply:

- url: /(.*)$
  static_files: \1
  upload: .*$

?

SoulAuctioneer commented Apr 13, 2017

So why would you do all of that rather than simply:

- url: /(.*)$
  static_files: \1
  upload: .*$

?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 13, 2017

@SoulAuctioneer I found that adding each mime type allowed by backend api hosted in the same space to function You're blanket .* block would prevent my api from working.
I actually found this document very very helpful in getting my static files as well as my backend Google api working at the same time.

ghost commented Jul 13, 2017

@SoulAuctioneer I found that adding each mime type allowed by backend api hosted in the same space to function You're blanket .* block would prevent my api from working.
I actually found this document very very helpful in getting my static files as well as my backend Google api working at the same time.

@hodoje

This comment has been minimized.

Show comment
Hide comment
@hodoje

hodoje Sep 2, 2017

Is this still valid? I'm creating a DjangoREST API as backend and Angular4 as frontend. I've put all my static files from 'dist' folder I've got in my Angular app to a folder named 'static' which is in my app folder, not in level with manage.py (because it doesn't work 100%).

hodoje commented Sep 2, 2017

Is this still valid? I'm creating a DjangoREST API as backend and Angular4 as frontend. I've put all my static files from 'dist' folder I've got in my Angular app to a folder named 'static' which is in my app folder, not in level with manage.py (because it doesn't work 100%).

@chrisajedmonds

This comment has been minimized.

Show comment
Hide comment
@chrisajedmonds

chrisajedmonds Sep 27, 2017

This didn't work for me.

The sequence of my handlers seems to dictate a choice between the CSS/JS/Other working and the removal of .html from the URL. I can't have both, it seems.

This didn't work for me.

The sequence of my handlers seems to dictate a choice between the CSS/JS/Other working and the removal of .html from the URL. I can't have both, it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment