Mercurial > piecrust2
view piecrust/admin/views/preview.py @ 852:4850f8c21b6e
core: Start of the big refactor for PieCrust 3.0.
* Everything is a `ContentSource`, including assets directories.
* Most content sources are subclasses of the base file-system source.
* A source is processed by a "pipeline", and there are 2 built-in pipelines,
one for assets and one for pages. The asset pipeline is vaguely functional,
but the page pipeline is completely broken right now.
* Rewrite the baking process as just running appropriate pipelines on each
content item. This should allow for better parallelization.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 17 May 2017 00:11:48 -0700 |
parents | 82509bce94ca |
children | dcdec4b951a1 |
line wrap: on
line source
from flask import current_app, g, make_response from flask.ext.login import login_required from piecrust.app import PieCrustFactory from piecrust.serving.server import Server from ..blueprint import foodtruck_bp @foodtruck_bp.route('/site/<sitename>/') @login_required def preview_site_root(sitename): return preview_site(sitename, '/') @foodtruck_bp.route('/site/<sitename>/<path:url>') @login_required def preview_site(sitename, url): root_dir = g.sites.get_root_dir(sitename) appfactory = PieCrustFactory( root_dir, cache_key='foodtruck', debug=current_app.debug) server = Server(appfactory, root_url='/site/%s/' % sitename) return make_response(server._run_request)