changeset 735:6c500fd3194f

Merge changes.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 01 Jun 2016 22:24:35 -0700
parents 3f01f63b7247 (current diff) e67da1f7293b (diff)
children 13ec290bfc13
files
diffstat 3 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/docs/templates/google.html	Wed Jun 01 22:19:01 2016 -0700
+++ b/docs/templates/google.html	Wed Jun 01 22:24:35 2016 -0700
@@ -1,5 +1,5 @@
 {% macro webfonts(fontnames) %}
-<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family={{ fontnames }}">
+<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family={{ fontnames }}">
 {% endmacro %}
 
 {% macro analytics(siteId) %}
--- a/foodtruck/views/preview.py	Wed Jun 01 22:19:01 2016 -0700
+++ b/foodtruck/views/preview.py	Wed Jun 01 22:24:35 2016 -0700
@@ -2,6 +2,7 @@
 from flask import g, make_response
 from flask.ext.login import login_required
 from piecrust import CACHE_DIR
+from piecrust.app import PieCrustFactory
 from piecrust.serving.server import Server
 from ..web import app
 
@@ -16,10 +17,12 @@
 @login_required
 def preview_site(sitename, url):
     root_dir = g.sites.get_root_dir(sitename)
-    sub_cache_dir = os.path.join(root_dir, CACHE_DIR, 'foodtruck')
-    server = Server(root_dir, sub_cache_dir=sub_cache_dir,
-                    root_url='/site/%s/' % sitename,
-                    debug=app.debug)
+    appfactory = PieCrustFactory(
+            root_dir,
+            cache_key='foodtruck',
+            debug=app.debug)
+    server = Server(appfactory,
+                    root_url='/site/%s/' % sitename)
     return make_response(server._run_request)
 
 
--- a/foodtruck/web.py	Wed Jun 01 22:19:01 2016 -0700
+++ b/foodtruck/web.py	Wed Jun 01 22:24:35 2016 -0700
@@ -3,6 +3,7 @@
 import time
 import logging
 from flask import Flask, g, request, render_template
+from werkzeug import SharedDataMiddleware
 from .configuration import (
         FoodTruckConfigNotFoundError, get_foodtruck_config)
 from .sites import FoodTruckSites, InvalidSiteError
@@ -30,6 +31,10 @@
                 'local': admin_root}
             }
 
+# Add a special route for the `.well-known` directory.
+app.wsgi_app = SharedDataMiddleware(
+        app.wsgi_app,
+        {'/.well-known': os.path.join(admin_root, '.well-known')})
 
 if os.path.isfile(config_path):
     app.config.from_pyfile(config_path)