changeset 1821:dc8a269f19cd gae

Optimized static file serving on GAE
author Tarashish Mishra <sunu0000@gmail.com>
date Tue, 02 Oct 2012 22:27:09 +0530
parents c82addbe87b2
children 3f633fafcfc3
files MoinMoin/apps/frontend/views.py MoinMoin/static/robots.txt app.yaml
diffstat 3 files changed, 74 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Mon Oct 01 18:45:46 2012 +0530
+++ b/MoinMoin/apps/frontend/views.py	Tue Oct 02 22:27:09 2012 +0530
@@ -79,43 +79,7 @@
 
 @frontend.route('/robots.txt')
 def robots():
-    return Response("""\
-User-agent: *
-Crawl-delay: 20
-Disallow: /+convert/
-Disallow: /+dom/
-Disallow: /+download/
-Disallow: /+modify/
-Disallow: /+content/
-Disallow: /+delete/
-Disallow: /+ajaxdelete/
-Disallow: /+ajaxdestroy/
-Disallow: /+ajaxmodify/
-Disallow: /+destroy/
-Disallow: /+rename/
-Disallow: /+revert/
-Disallow: /+index/
-Disallow: /+jfu-server/
-Disallow: /+sitemap/
-Disallow: /+similar_names/
-Disallow: /+quicklink/
-Disallow: /+subscribe/
-Disallow: /+backrefs/
-Disallow: /+wanteds/
-Disallow: /+orphans/
-Disallow: /+register
-Disallow: /+recoverpass
-Disallow: /+usersettings
-Disallow: /+login
-Disallow: /+logout
-Disallow: /+bookmark
-Disallow: /+diff/
-Disallow: /+diffraw/
-Disallow: /+search
-Disallow: /+dispatch/
-Disallow: /+admin/
-Allow: /
-""", mimetype='text/plain')
+    return app.send_static_file('robots.txt')
 
 
 @frontend.route('/favicon.ico')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/static/robots.txt	Tue Oct 02 22:27:09 2012 +0530
@@ -0,0 +1,35 @@
+User-agent: *
+Crawl-delay: 20
+Disallow: /+convert/
+Disallow: /+dom/
+Disallow: /+download/
+Disallow: /+modify/
+Disallow: /+content/
+Disallow: /+delete/
+Disallow: /+ajaxdelete/
+Disallow: /+ajaxdestroy/
+Disallow: /+ajaxmodify/
+Disallow: /+destroy/
+Disallow: /+rename/
+Disallow: /+revert/
+Disallow: /+index/
+Disallow: /+jfu-server/
+Disallow: /+sitemap/
+Disallow: /+similar_names/
+Disallow: /+quicklink/
+Disallow: /+subscribe/
+Disallow: /+backrefs/
+Disallow: /+wanteds/
+Disallow: /+orphans/
+Disallow: /+register
+Disallow: /+recoverpass
+Disallow: /+usersettings
+Disallow: /+login
+Disallow: /+logout
+Disallow: /+bookmark
+Disallow: /+diff/
+Disallow: /+diffraw/
+Disallow: /+search
+Disallow: /+dispatch/
+Disallow: /+admin/
+Allow: /
--- a/app.yaml	Mon Oct 01 18:45:46 2012 +0530
+++ b/app.yaml	Tue Oct 02 22:27:09 2012 +0530
@@ -8,6 +8,44 @@
   MOINCFG: ../wikiconfig_gae.py
 
 handlers:
+- url: /%2Bserve/anywikidraw
+  static_dir: support/xstatic/pkg/anywikidraw/data
+
+- url: /%2Bserve/ckeditor
+  static_dir: support/xstatic/pkg/ckeditor/data
+
+- url: /%2Bserve/jquery
+  static_dir: support/xstatic/pkg/jquery/data
+
+- url: /%2Bserve/jquery_file_upload
+  static_dir: support/xstatic/pkg/jquery_file_upload/data
+
+- url: /%2Bserve/svgedit_moin
+  static_dir: support/xstatic/pkg/jsvgedit_moin/data
+
+- url: /%2Bserve/svgweb
+  static_dir: support/xstatic/pkg/svgweb/data
+
+- url: /%2Bserve/twikidraw_moin
+  static_dir: support/xstatic/pkg/twikidraw_moin/data
+
+- url: /_themes/foobar
+  static_dir: MoinMoin/themes/foobar/static
+
+- url: /_themes/modernized
+  static_dir: MoinMoin/themes/modernized/static
+
+- url: /favicon.ico
+  static_files: MoinMoin/static/logos/favicon.ico
+  upload: MoinMoin/static/logos/favicon.ico
+
+- url: /robots.txt
+  static_files: MoinMoin/static/robots.txt
+  upload: MoinMoin/static/robots.txt
+
+- url: /static
+  static_dir: MoinMoin/static
+
 - url: /.*
   script: moin.application