Static files question

36 views
Skip to first unread message

Kate

unread,
Nov 15, 2011, 2:10:15 PM11/15/11
to Google App Engine
Lets say I have the following directories
/stylesheets
/static/images
/static/images/ads
Can I do the following
- url: /images
static_dir: static/images
- url: /images/ads
static_dir: static/images/ads /*that is do subdirectories have the
be explicitly listed
- url /stylesheets
static_dir /stylesheets /* that is can you have more than one
virtual
static_dir? */

Kyle Finley

unread,
Nov 15, 2011, 2:44:58 PM11/15/11
to google-a...@googlegroups.com
- url: /images 
  static_dir: static/images 

Yes

- url: /images/ads 
  static_dir: static/images/ads  /* that is do subdirectories have the be explicitly listed 

No, all subdirectories will be included:
images/ads
images/cats

- url /stylesheets 
 static_dir /stylesheets /* that is can you have more than one virtual static_dir? */

Yes

- Kyle

Kate

unread,
Nov 15, 2011, 10:58:29 PM11/15/11
to Google App Engine
Thanks Kylie, but why are these files still showing as "requests" on
my summary page?


On Nov 15, 2:44 pm, Kyle Finley <kylefin...@gmail.com> wrote:
> - url: /images
>   static_dir: static/images
>
> *Yes*
>
> - url: /images/ads
>   static_dir: static/images/ads  /* that is do subdirectories have the be
> explicitly listed
>
> *No, all subdirectories will be included:*
> *images/ads*
> *images/cats*
>
> - url /stylesheets
>  static_dir /stylesheets /* that is can you have more than one virtual static_dir?
> */
>
> *Yes*
>
> - Kyle

Kyle Finley

unread,
Nov 16, 2011, 12:05:18 AM11/16/11
to google-a...@googlegroups.com
Any time a user / browser requests the file it is counted as a request, and logged in the summary page. To limit the amount of request made from the user's browser you can cache the file in the user's browser. 

To do this on Google App Engine add a default_expiration to your app.yaml file:

default_expiration: "10m"

- url: /images 
  static_dir: static/images 

The "10m" will cache files in your static/images folder for 10 minutes. If one user loads the page 100 times in 10 minutes it will only show up as one request. After 10 minutes the browse will make a new request adding another download to your summary page. You can extend the time by changing the default_expiration: "1d" <- for example will cache files for one day.

Here's full documentation for app.yaml settings:

Does that answer your question?

- Kyle


>
> - Kyle

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.


Reply all
Reply to author
Forward
0 new messages