ludovicchabant / piecrust2 Goto Github PK
View Code? Open in Web Editor NEWA simple yet powerful static website generator and lightweight CMS
License: Other
A simple yet powerful static website generator and lightweight CMS
License: Other
Using v3.3.0
I have tested the following with a blank site with default theme generated by chef theme override
.
I have made a partial with a macro in it. I import the partial into my default.html theme.
If I attempt to use any of the pcurl
/pctagurl
/pcyearurl
etc functions in this macro, I will get a rendering error:
Error rendering page: .../piecrust/testsite/pages/_index.html
default.html: Error rendering Jinja markup
'pcurl' is undefined
It looks like these functions are not being exposed to imported files. Have I missed something? Python is not my native language!
PieCrust is by far my favorite static site generator, and I love that it's been rewritten in Python. I noticed, however, in this version it seems like the "--portable" option which created relative links for everything is no longer available. I'm using PieCrust for a website which includes a tilde, typical of username based directories, and unfortunately it doesn't want to bake it that way.
For instance, with site.root defined as /~test/, it returns:
Errors found in ../../.virtualenvs/piecrust/lib/python3.4/site-packages/piecrust/resources/theme/pages/_index.html:
URI '/%7Etest/' is not a full URI.
My workaround has been to assign the site root a unique string of characters, then run a recursive sed command to replace it with what it should be, but obviously I'd prefer to have this "baked in", so to speak.
Hello, again :)
I'm having an issue using version 2.0.0rc1 (installed with pip)
When I bake the site I recieve an error that I don't know how to fix it.
A current entry already exists for: 8a086d6182...
I examine _cache and I don't find that file.
And... wow, when I examine _counter I find months like
5 not 05
So... 'taxonomy pages' and 'assets' can't be proccessed in bake.
Take a look:
http://zxdevs.com/files/varios/piecrust_issue/issue002.jpg
This didn't happen in 2.0.0b5
http://zxdevs.com/files/varios/piecrust_issue/issue001.jpg
Those screenshots are of today bakes (in different computers with different versions of Piecrust)
This is a problem because all internal links (that I made in content) are giving an error or showing out of date pages.
Please, could you help me again, Ludovic?
Thanks a lot :)
Hi, Ludovic!!
This is not an issue, actually it's my fault. I don't know what I have to do. Please, excuse me for my low coding skill :(
May be, I'm asking a silly thing but I've tried almost everything I thought Anyway, sorry again...
I've downloaded last version of Python. I've installed Piecrust2 with Pip.
My PieCrust2 folder is this:
And config.yml is like that:
So, let's bake site:
And this is what I have:
Some code that I have:
My config.yml looks as follows:
baker:
processors:
- imageoptimizer
- cssmin
- copy
jinja:
twig_compatibility: true
site:
author: Michal Zimmermann
description: Pieces of knowledge from the world of GIS.
category_url: category/%category%
enable_gzip: true
hide_quickstart: true
post_url: '%year%/%slug%'
posts_per_page: 10
pretty_urls: true
root: /posts
tag_url: tag/%tag%
title: Michal Zimmermann
trailing_slash: true
smartypants:
enable: true
In my HTML template, I use <h1><a href="{{pcurl(site.root)}}">Michal Zimmermann</a></h1>
which should take me to the www.zimmi.cz/posts (as www.zimmi.cz is my root domain). It takes me to www.zimmi.cz/posts/posts instead.
Using <a class="pagination" href="{{pagination.next_page}}">
takes me to www.zimmi.cz/2 where it should take me to www.zimmi.cz/posts/2 instead.
<img src="{{assets.lines}}" title="Self-intersecting lines" class="img-responsive centered">
is translated to
<img src="/_asset/posts/2015-03-30_postgis-count-line-self-intersections-assets/lines.png" title="Self-intersecting lines" class="img-responsive centered">
on a localhost
and to
<img src="/postsposts/2015/postgis-count-line-self-intersections/lines.png" title="Self-intersecting lines" class="img-responsive centered">
on a production environment.
Is this a bug or is it my faulty settings?
When i run chef bake
assets run processor after pages and posts compilation process. Seems like normal workflow.
But it is not useful for amp static pages where custom css should included inline into page. I think currently it is not problem for me cause i can include ready css file directly into template(i think). But i have some toughts to implement styles preprocessors like less or sass and styles. Postprocessing assets seems make it impossible directly with PieCrust2 config.
So question is: Is PieCrust2 have any possibility to run assests compilation before pages and posts processing?
Thanks for great and fast builder. :)
With the latest repo code, I cannot bake an index page. RSS feed is baked with the newly added post while index.html stays as it was. The post itself is baked correctly.
trying to follow this part of the tutorial:
https://bolt80.com/piecrust/en/latest/docs/admin-panel/
when running: (in which folder should I be actually ?)
chef admin run
I get the error:
Exception on / [GET]
Traceback (most recent call last):
File "c:\virtualenvs\piecrust\lib\site-packages\flask\app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "c:\virtualenvs\piecrust\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\virtualenvs\piecrust\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\virtualenvs\piecrust\lib\site-packages\flask\_compat.py", line 33, in reraise
raise value
File "c:\virtualenvs\piecrust\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "c:\virtualenvs\piecrust\lib\site-packages\flask\app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\virtualenvs\piecrust\lib\site-packages\flask_login.py", line 789, in decorated_view
return func(*args, **kwargs)
File "c:\virtualenvs\piecrust\lib\site-packages\piecrust\admin\views\dashboard.py", line 74, in index
return render_template('dashboard.html', **data)
File "c:\virtualenvs\piecrust\lib\site-packages\flask\templating.py", line 127, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "c:\virtualenvs\piecrust\lib\site-packages\jinja2\environment.py", line 830, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "c:\virtualenvs\piecrust\lib\site-packages\jinja2\environment.py", line 791, in get_template
return self._load_template(name, self.make_globals(globals))
File "c:\virtualenvs\piecrust\lib\site-packages\jinja2\environment.py", line 765, in _load_template
template = self.loader.load(self, name, globals)
File "c:\virtualenvs\piecrust\lib\site-packages\jinja2\loaders.py", line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "c:\virtualenvs\piecrust\lib\site-packages\flask\templating.py", line 64, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: dashboard.html
hi all!! and thanks to the new great version of piecrust using python (great idea indeed!)
i try to create a new game content:
config.yml (using 2 spaces)
site:
description: myTest
pretty_urls: true
title: myPiecrust2
sources:
games: {}
routes:
- url: /game/%path%
source: games
tag_url: tag/%tag%
category_url: cat/%category%
smartypants:
enable: true
When i try list the games thrown an error:
[piecrust.app] Creating site configuration...
[piecrust.app] Loading configuration from cache...
[piecrust.cache] Reading cache: /home/skywalker/http_docs/_cache/app/config.json
[piecrust.serving] Searching 23 entries for asset with path: /list
[piecrust.environment] Acquiring lock for: pages:list.md
[piecrust.environment] 'pages:list.md' not found in cache, must build.
[piecrust.sources.base] Building page: /home/skywalker/http_docs/pages/list.md
[piecrust.cache] Reading cache: /home/skywalker/http_docs/_cache/pages/pages_list.md.json
[piecrust.environment] Invalidating cache item '/list:1'.
[piecrust.environment] Invalidating FS cache item '/list:1'.
[piecrust.environment] Acquiring lock for: /list:1
[piecrust.environment] '/list:1' not found in cache, must build.
[piecrust.templating.jinjaengine] Creating Jinja environment with folders: ['/home/skywalker/http_docs/templates', '/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/resources/theme/templates']
[piecrust.sources.base] Scanning for pages in: /home/skywalker/http_docs/games
[piecrust.environment] Starting batch cache operation.
[piecrust.environment] Acquiring lock for: games:ghost.md
[piecrust.environment] 'games:ghost.md' not found in cache, must build.
[piecrust.sources.base] Building page: /home/skywalker/http_docs/games/ghost.md
[piecrust.cache] Reading cache: /home/skywalker/http_docs/_cache/pages/games_ghost.md.json
[piecrust.environment] Ending batch cache operation.
[piecrust.serving] Error while loading data for: ghost.md
Traceback (most recent call last):
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/data/base.py", line 102, in _load
self._loadCustom()
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/data/base.py", line 129, in _loadCustom
page_url = self._get_uri()
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/data/base.py", line 125, in _get_uri
raise Exception("Can't get route for page: %s" % page.path)
Exception: Can't get route for page: /home/skywalker/http_docs/games/ghost.md
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/serving.py", line 133, in _run_piecrust
response = self._try_serve_page(app, environ, request)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/serving.py", line 299, in _try_serve_page
rendered_page = render_page(render_ctx)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/rendering.py", line 104, in render_page
fs_cache_time=page_time)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/environment.py", line 70, in get
item = item_maker()
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/rendering.py", line 103, in <lambda>
lambda: _do_render_page_segments(page, page_data),
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/rendering.py", line 171, in _do_render_page_segments
filename=page.path)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/templating/jinjaengine.py", line 46, in renderString
return tpl.render(data)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/_compat.py", line 36, in reraise
raise value.with_traceback(tb)
File "<template>", line 5, in <module>
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/environment.py", line 397, in getattr
return getattr(obj, attribute)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/data/base.py", line 49, in __getattr__
return self.getValue(name)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/data/base.py", line 57, in getValue
self._load()
File "/home/skywalker/piecrust/lib/python3.4/site-packages/piecrust/data/base.py", line 104, in _load
raise Exception("Error while loading data for: %s" % self._page.rel_path) from ex
Exception: Error while loading data for: ghost.md
[werkzeug] 172.16.0.151 - - [04/Dec/2014 10:45:44] "GET /list HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/skywalker/piecrust-git/piecrust/serving.py", line 389, in __call__
return self.server._run_request(environ, start_response)
File "/home/skywalker/piecrust-git/piecrust/serving.py", line 93, in _run_request
return self._run_piecrust(environ, start_response)
File "/home/skywalker/piecrust-git/piecrust/serving.py", line 133, in _run_piecrust
response = self._try_serve_page(app, environ, request)
File "/home/skywalker/piecrust-git/piecrust/serving.py", line 299, in _try_serve_page
rendered_page = render_page(render_ctx)
File "/home/skywalker/piecrust-git/piecrust/rendering.py", line 104, in render_page
fs_cache_time=page_time)
File "/home/skywalker/piecrust-git/piecrust/environment.py", line 70, in get
item = item_maker()
File "/home/skywalker/piecrust-git/piecrust/rendering.py", line 103, in <lambda>
lambda: _do_render_page_segments(page, page_data),
File "/home/skywalker/piecrust-git/piecrust/rendering.py", line 171, in _do_render_page_segments
filename=page.path)
File "/home/skywalker/piecrust-git/piecrust/templating/jinjaengine.py", line 46, in renderString
return tpl.render(data)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/_compat.py", line 36, in reraise
raise value.with_traceback(tb)
File "<template>", line 5, in <module>
File "/home/skywalker/piecrust/lib/python3.4/site-packages/jinja2/environment.py", line 397, in getattr
return getattr(obj, attribute)
File "/home/skywalker/piecrust-git/piecrust/data/base.py", line 49, in __getattr__
return self.getValue(name)
File "/home/skywalker/piecrust-git/piecrust/data/base.py", line 57, in getValue
self._load()
File "/home/skywalker/piecrust-git/piecrust/data/base.py", line 104, in _load
raise Exception("Error while loading data for: %s" % self._page.rel_path) from ex
Exception: Error while loading data for: ghost.md
[werkzeug] 172.16.0.151 - - [04/Dec/2014 10:45:44] "GET /list?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
[werkzeug] 172.16.0.151 - - [04/Dec/2014 10:45:44] "GET /list?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
[werkzeug] 172.16.0.151 - - [04/Dec/2014 10:45:44] "GET /list?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
[werkzeug] 172.16.0.151 - - [04/Dec/2014 10:45:44] "GET /list?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
[werkzeug] 172.16.0.151 - - [04/Dec/2014 10:45:44] "GET /list?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
[werkzeug] 172.16.0.151 - - [04/Dec/2014 10:45:44] "GET /list?__debugger__=yes&cmd=resource&f=source.png HTTP/1.1" 200 -
pages/list-games.md
---
title: dskywalk
layout: piano
---
<div class="grid_12 media_left">
<h1>List games!</h1>
{% for game in games %}
<h2><a href="{{ game.url }}">{{ game.title }}</a></h2>
{% endfor %}
</div>
games/ghost.md
---
title: Ghost Game
time: '12:02:04'
---
This is a brand new page.
routes in def routes(self):
OrderedDict([('source', 'pages'), ('taxonomy', None), ('url', '/%path:path%'), ('page_suffix', '/%num%'), ('func', 'pcurl(path)')])
OrderedDict([('source', 'posts'), ('taxonomy', None), ('url', '/%year%/%month%/%day%/%slug%'), ('page_suffix', '/%num%'), ('func', 'pcposturl(year,month,day,slug)')])
OrderedDict([('source', 'posts'), ('taxonomy', 'tags'), ('url', '/tag/%tag%'), ('page_suffix', '/%num%'), ('func', 'pctagurl(tag)')])
OrderedDict([('source', 'posts'), ('taxonomy', 'categories'), ('url', '/cat/%category%'), ('page_suffix', '/%num%'), ('func', 'pccaturl(category)')])
OrderedDict([('source', 'theme_pages'), ('taxonomy', None), ('url', '/%path:path%'), ('page_suffix', '/%num%'), ('func', 'pcurl(path)')])
maybe i missed something on config or the page content?
Thanks!!
I've been using my own CssMinProcessor with v1. Is it possible to define such a plugin with v2 as well? How does it work exactly? Docs doesn't say much about this.
I've just installed piecrust via pip on Arch Linux
initiated some site, have added some pages and posts, run the chef serve, all works as it should be.
now, chef bake just does not create the static site.
i've tried to find the problem , now my pages/_index.html looks like this:
________________________________________________________________ Visible both for Serve and Bake {% if pagination.has_posts %}{% for post in pagination.posts %} {% include 'partial_post.html' %} {% endfor %} {% if pagination.prev_page %}{% endif %} {% if pagination.next_page %}{% endif %} {% else %} Fall here if bake could not find pagination {% endif %} _________________________________________________________________________________________________ and the result in _counter/index.html : ______________________________________when chef serve shows -- Visible both for Serve and Bake
Fall here if bake could not find pagination
| | | | | Visible both for Serve and Bake
| || | | | |Second Post
| Sep 08, 2020 | | | | || | | | | |Second Post Test
|First Post
| Sep 08, 2020 | | | | || | | | | |First Post Test
|
So the bake could not inizialize pagination , or anything
I used to have categories (similar for tags) page with v1 defined as follows:
categories.html
---
title: Categories
description: Categories
layout: page
format: none
---
<ul>
{% for c in blog.categories %}
<li><a href="{{pccaturl(c.name)}}">{{c.name}}</a></li>
{% endfor %}
</ul>
_category.html
---
format: none
---
<section>
{% for post in pagination.posts %}
{% include 'partial_post.html' %}
{% endfor %}
</section>
The same layout gives me an error with v2:
jinja2.exceptions.UndefinedError
jinja2.exceptions.UndefinedError: 'blog' is undefined
How do I list categories (and tags) with v2? I looked into debug_info and didn't find anything related to this.
Asciidoctor( http://www.asciidoctor.org) is implemented in ruby language. I like its markup very much and conversant with it since long.
Piecrust is in python,
can i use Piecrust such that I do not need to use markdown , but rather may i use asciidoctor's asciidoc markup?
Please add this feature as plugin, if possible
Hi,
Using ubuntu 14.04
the install process returns an error:
distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip_build_root/bcrypt/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-yZqnPd-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/bcrypt
Storing debug log for failure in /home/castillo/.pip/pip.log
What can I do? Sorry I'm quite the noob.
Hello
I did a stock install of PieCrust on my mac 10.13.6:
$ pip list | grep -i pie
PieCrust 3.2.1
$ chef --version
chef 3.2.1
$ chef init myblog
$ cd myblog/
$ chef serve
Starting processing loop with output: /Users/mql/Sites/testsite/myblog/_cache/cf1e8c14e54505f60aa10ceb8d5d8ab3/server
[ 12.3 ms] setup baker
[ 4.9 ms] cache templates
Running on http://localhost:8080/ (Press CTRL+C to quit)
127.0.0.1 - - [23/Jul/2018 22:37:22] "GET / HTTP/1.1" 200 -
^C
Shutting server down...
server serves home page OK
but then:
$ chef prepare page my-new-page
Creating content: /Users/mql/Sites/testsite/myblog/pages/my-new-page.md
$ chef serve
Starting processing loop with output: /Users/mql/Sites/testsite/myblog/_cache/cf1e8c14e54505f60aa10ceb8d5d8ab3/server
[ 12.5 ms] setup baker
[ 4.9 ms] cache templates
* Running on http://localhost:8080/ (Press CTRL+C to quit)
127.0.0.1 - - [23/Jul/2018 22:37:53] "GET /my-new-page HTTP/1.1" 404 -
127.0.0.1 - - [23/Jul/2018 22:37:58] "GET /my-new-page.html HTTP/1.1" 404 -
127.0.0.1 - - [23/Jul/2018 22:38:05] "GET /pages/my-new-page.html HTTP/1.1" 404 -
127.0.0.1 - - [23/Jul/2018 22:38:09] "GET /pages/my-new-page HTTP/1.1" 404 -
This is a brand new page.
Thanks for answering email question regarding getting Sass working; you were right, I hadn't installed it! Sorry about that.
Is it possible to get Sass sourcemaps working?
Hello, I see several problems with the last version of PieCrust (chef 2.0.0rc1) (on Archlinux, piecrust up to date with pip)
Let me know if you need further details about this problem, and thank you for the tool you're building, it's great :-)
chef --debug admin
[piecrust.main] Using cache key: default
[piecrust.app] Creating site configuration...
[piecrust.appconfig] Loading configuration from cache...
[piecrust.cache] Reading cache: /home/kevin/git/mcgdb_website/_cache/c21f969b5f03d33d43e04f8f136e7682/app/config.json
[piecrust.commands.builtin.scaffolding] Skipping source 'theme_pages' because it's a theme source.
[piecrust.main] [ 168.7 ms] initialized PieCrust
[piecrust.main] 'Namespace' object has no attribute 'monitor_assets'
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/piecrust/main.py", line 70, in main
exit_code = _run_chef(pre_args, argv)
File "/usr/lib/python3.5/site-packages/piecrust/main.py", line 296, in _run_chef
exit_code = result.func(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/commands/builtin/admin.py", line 53, in checkedRun
return self._runFoodTruck(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/commands/builtin/admin.py", line 59, in _runFoodTruck
if (ctx.args.monitor_assets and (
AttributeError: 'Namespace' object has no attribute 'monitor_assets'
chef --debug admin run
[piecrust.main] Using cache key: default
[piecrust.app] Creating site configuration...
[piecrust.appconfig] Loading configuration from cache...
[piecrust.cache] Reading cache: /home/kevin/git/mcgdb_website/_cache/c21f969b5f03d33d43e04f8f136e7682/app/config.json
[piecrust.commands.builtin.scaffolding] Skipping source 'theme_pages' because it's a theme source.
[piecrust.main] [ 169.9 ms] initialized PieCrust
[foodtruck.web] Using FoodTruck admin root: /home/kevin/git/mcgdb_website
[werkzeug] * Running on http://localhost:8090/ (Press CTRL+C to quit)
[werkzeug] * Restarting with stat
[piecrust.main] Using cache key: default
[piecrust.app] Creating site configuration...
[piecrust.appconfig] Loading configuration from cache...
[piecrust.cache] Reading cache: /home/kevin/git/mcgdb_website/_cache/c21f969b5f03d33d43e04f8f136e7682/app/config.json
[piecrust.commands.builtin.scaffolding] Skipping source 'theme_pages' because it's a theme source.
[piecrust.main] [ 164.5 ms] initialized PieCrust
[piecrust.main] __init__() got an unexpected keyword argument 'debug'
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/piecrust/main.py", line 70, in main
exit_code = _run_chef(pre_args, argv)
File "/usr/lib/python3.5/site-packages/piecrust/main.py", line 296, in _run_chef
exit_code = result.func(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/commands/builtin/admin.py", line 54, in checkedRun
return ctx.args.sub_func(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/commands/builtin/admin.py", line 64, in _runFoodTruck
proc_loop = ProcessingLoop(ctx.app.root_dir, out_dir, debug=ctx.args.debug)
TypeError: __init__() got an unexpected keyword argument 'debug'
[foodtruck.main] Shutting down SSE generators from main...
chef --debug publish sync
[piecrust.publishing.publisher] Running publish target 'sync' with publisher: rsync
[piecrust.main] Error publishing to target: sync
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/piecrust/publishing/publisher.py", line 111, in run
success = pub.run(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/publishing/base.py", line 52, in run
args = self._getCommandArgs(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/publishing/rsync.py", line 13, in _getCommandArgs
orig = self.getConfigValue('source', ctx.bake_our_dir)
AttributeError: 'PublishingContext' object has no attribute 'bake_our_dir'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/piecrust/main.py", line 70, in main
exit_code = _run_chef(pre_args, argv)
File "/usr/lib/python3.5/site-packages/piecrust/main.py", line 296, in _run_chef
exit_code = result.func(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/commands/base.py", line 36, in checkedRun
return self.run(ctx)
File "/usr/lib/python3.5/site-packages/piecrust/commands/builtin/publishing.py", line 77, in run
log_file=ctx.args.log_publisher)
File "/usr/lib/python3.5/site-packages/piecrust/publishing/publisher.py", line 114, in run
"Error publishing to target: %s" % target) from ex
piecrust.publishing.publisher.PublishingError: Error publishing to target: sync
I think there is a typo in processing/sitemap.py line 77:
if sm_cfg:
args.update(cm_cfg)
It should read sm_cfg
.
I've been using post_url: '%year%/%slug%'
config for posts URLs with v1. When visiting such an URL with v2, it gives the following error:
I guess Piecrust wants me to provide valid %month%, but I don't want to use it. I use flat hierarchy so every post is located inside posts directory with no nested subdirectories.
Hey, I am going through the documentation trying to get started with a website, and am on "Part 3: Adding colours", where we create some css using less.
The docs state that we link to the CSS with the following HTML:
<link rel="stylesheet" type="text/css" href="/piecrust/en/latest/myblog.css"/>
It seems the hyperlink is incorrect, as the path should be /myblog.css
not /piecrust/en/latest/myblog.css
.
Ahh, now that I look into the source code, it seems like you need to escape your {{ site.root }}
with {% raw %}
so it renders it as {{ site.root }}
hi.
root@AR:/usr/local/piecrust2-site# chef init mywebsite
Traceback (most recent call last):
File "/usr/local/bin/chef", line 11, in
load_entry_point('PieCrust==0.0', 'console_scripts', 'chef')()
File "/usr/local/lib/python2.7/dist-packages/setuptools-28.8.0-py2.7.egg/pkg_resources/init.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/setuptools-28.8.0-py2.7.egg/pkg_resources/init.py", line 2631, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/setuptools-28.8.0-py2.7.egg/pkg_resources/init.py", line 2291, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/setuptools-28.8.0-py2.7.egg/pkg_resources/init.py", line 2297, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python2.7/dist-packages/PieCrust-0.0-py2.7.egg/piecrust/main.py", line 201
raise Exception("Can't write PID file: %s" % res.pid_file) from ex
^
SyntaxError: invalid syntax
root@AR:/usr/local/piecrust2-site#
Error loading page: ../../../../../usr/local/lib/python3.4/dist-packages/PieCrust-2.0.0a6_1_gd5f1747-py3.4.egg/piecrust/resources/theme/pages/_index.html
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/PieCrust-2.0.0a6_1_gd5f1747-py3.4.egg/piecrust/page.py", line 243, in load_page
return _do_load_page(app, path, path_mtime)
File "/usr/local/lib/python3.4/dist-packages/PieCrust-2.0.0a6_1_gd5f1747-py3.4.egg/piecrust/page.py", line 284, in _do_load_page
cache.write(cache_path, json.dumps(cache_data))
File "/usr/local/lib/python3.4/dist-packages/PieCrust-2.0.0a6_1_gd5f1747-py3.4.egg/piecrust/cache.py", line 85, in write
with codecs.open(cache_path, 'w', 'utf-8') as fp:
File "/usr/lib/python3.4/codecs.py", line 896, in open
file = builtins.open(filename, mode, buffering)
OSError: [Errno 36] File name too long: '/home/michal/dev/www/posts.zimmi.cz/_cache/pages/__index__.._.._.._.._.._usr_local_lib_python3.4_dist-packages_PieCrust-2.0.0a6_1_gd5f1747-py3.4.egg_piecrust_resources_theme_pages__index.html.json'
Baking was aborted due to 1 error(s):
('Error loading page: /usr/local/lib/python3.4/dist-packages/PieCrust-2.0.0a6_1_gd5f1747-py3.4.egg/piecrust/resources/theme/pages/_index.html', OSError(36, 'File name too long'))
Baking was aborted due to errors.
using the latest git repo code, haven't seen this error before.
Using
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>{{site.title}}</title>
<link>http://zimmi.cz/posts</link>
<lastBuildDate>{{now|date('r')}}</lastBuildDate>
<pubDate>{{now|date('r')}}</pubDate>
<description>{{site.description}}</description>
{% for post in blog.posts.limit(10) %}
<item>
<title>{{ post.title }}</title>
<link>http://zimmi.cz{{ post.url }}</link>
<pubDate>{{ post.timestamp|date('r') }}</pubDate>
<guid>http://zimmi.cz{{post.url}}</guid>
<description>{{ post.content }}</description>
</item>
{% endfor %}
</channel>
</rss>
results in
PieCrust 1 date formats won't work in PieCrust 2. You probably want a format that look like 'r'. Please check the `strftime` formatting page here: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
However, there is no filter named strptime
nor strftime
in v2. How do I format the date then?
Hello,
I'm working on a website generator for my dive logs (http://git.0x972.info/subsurface2jinja.git/tree/), that I developed with PieCrust concepts in mind. Now I see that v2 is based on Python, and I think that my tool could benefit from PieCrust engine, so I'm wondering if I could adapt my subsurface2jinja into a Piecrust plugin. You can take a look at http://plongee.0x972.info for the result.
Is there any documentation for writing such plugins ? I already connected a piecrust_plugin class to Piecrust, but I'm not sure how to implement the class get* methods should return.
Thanks for your help
Here's the error:
$ chef serve --admin
Starting processing loop with output: ...
[ 15.8 ms] setup baker
[ 6.1 ms] cache templates
No module named 'flask.ext'
Here's the problem:
The following old deprecated code was removed. (#2385)
* flask.ext - import extensions directly by their name instead of through the flask.ext namespace. For example, import flask.ext.sqlalchemy becomes import flask_sqlalchemy.
That's from the 1.0 changelog.
Hi, again, Ludo :)
I found some new bugs.
First:
I have an strange error with new post/older posts in index, when I click in older posts in order to watch page 2 of the blog, I get an error because piecrust baked this wrong url.
I have this code in template:
And.. related to this, It doesn't work with tags because piecrust bakes a url like
It doesn't have first part of url, in this case: http://www.magarciaguerra.com/
But, this is also another thing that brings new problems with special characters. In Piecrust 1, tags with 'á', 'é' or 'ñ' were simplified, for example:
'informática' >>> 'informatica' (without 'á')
In piecrust2, piecrust bakes special characters and all the internal links are a mess, also, navigation links have this new url with, for example, "%25c3%25..."
Could we have again those simplified names for tags?
Thanks for all, I hope this helps ;)
Hey there,
I'm following the tutorial and the beginning of the third part is failing:
$ chef serve
* Running on http://localhost:8080/ (Press CTRL+C to quit)
Errors found in assets/myblog.less:
[Errno 2] No such file or directory: '/home/alfeto/work/aikoo/piecrust/bla.bla/assets/myblog.less_9713fecd8a38a0615d45a1302332d809.map' -> '/home/alfeto/work/aikoo/piecrust/bla.bla/_cache/server_c21f969b5f03d33d43e04f8f136e7682/proc/less/myblog.less_9713fecd8a38a0615d45a1302332d809.map'
[ 130.1 ms] processed 0 assets.
Using Python 3.4.3 and PieCrust==2.0.0b3
I ran into a problem when I tried setting a root URI in config.yml. My piecrust2 sources are located in /var/www/piecrust with baked output going into /var/www/piecrust/_counter.
My Apache server serves the baked website under the http:///piecrust/_counter URL. In order to be able to use {{ site.root }}
in Jinja, I configured site/root in config.yml:
site:
root: '/piecrust/_counter/'
Unfortunately, this doesn't work. When I bake the site, it prints:
# chef bake -f
[ 0.9 ms] cleaned cache (reason: ordered to)
[ 55.4 ms] [1] /piecrust/_counter/
[ 56.4 ms] [0] /piecrust/_counter/test
[ 55.4 ms] [2] /piecrust/_counter/test1
[ 3.3 ms] [3] assets/css/site.css
[ 2.5 ms] [0] assets/js/site.js
As you can see, my pages are output into a site.root folder under _counter. Assets are not affected. I hacked around the problem by inserting this code
# HACK: remove site/root (else page is generated under _counter/site/root)
if uri.startswith(self.site_root):
uri = uri[len(self.site_root):]
at piecrust/baking/single.py line 113.
chef
now outputs the expected page names (test, test1, [main page]), and my pages are generated right in the _counter
directory.
Can you please take a look into this issue? I'm not sure about any side effects of my dirty hack.
Thanks!
When running chef with latest on OSX (virtual env enabled), it only prints "Unknown locale: UTF-8".
This is due to OSX (faultily?) putting UTF-8 in the LC_CTYPE environment variable and is apparently widespread with Python programs.
The version in pip is not affected.
Workarounds:
Stacktrace:
[piecrust.main] unknown locale: UTF-8
Traceback (most recent call last):
File ".../PieCrust2/piecrust/main.py", line 58, in main
exit_code = _run_chef(pre_args)
File ".../PieCrust2/piecrust/main.py", line 182, in _run_chef
commands = sorted(app.plugin_loader.getCommands(),
File ".../PieCrust2/piecrust/plugins/base.py", line 75, in getCommands
return self._getPluginComponents('getCommands')
File ".../PieCrust2/piecrust/plugins/base.py", line 113, in _getPluginComponents
for plugin in self.plugins:
File ".../PieCrust2/piecrust/plugins/base.py", line 51, in plugins
self._ensureLoaded()
File ".../PieCrust2/piecrust/plugins/base.py", line 93, in _ensureLoaded
from piecrust.plugins.builtin import BuiltInPlugin
File ".../PieCrust2/piecrust/plugins/builtin.py", line 16, in
from piecrust.commands.base import HelpCommand
from piecrust.formatting.textileformatter import TextileFormatter
File ".../PieCrust2/piecrust/formatting/textileformatter.py", line 1, in
from textile import textile
File ".../PieCrust2/venv/lib/python3.4/site-packages/textile/init.py", line 3, in
from .core import textile, textile_restricted, Textile
File ".../PieCrust2/venv/lib/python3.4/site-packages/textile/core.py", line 23, in
import regex
File ".../PieCrust2/venv/lib/python3.4/site-packages/regex.py", line 673, in
_pattern_type = type(_compile("", 0, {}))
File ".../PieCrust2/venv/lib/python3.4/site-packages/regex.py", line 434, in _compile
pattern_locale = _getlocale()[1]
File ".../PieCrust2/venv/lib/python3.4/locale.py", line 575, in getlocale
return _parse_localename(localename)
File ".../PieCrust2/venv/lib/python3.4/locale.py", line 484, in _parse_localename
raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8
Hi!
I'm migrating an old web site, that was built with the PHP Piecrust site generator. Some posts have the tag, that worked as a flag to tell Piecrust to display the portion before it as an excerpt when paginating posts.
It seems to be still working, however, I couldn't find a way to handle the "More" link. I thought about adding a link to More or Show More, but there are posts without that flag. So I'd like to have some way to find out whether an item in the pagination iterator has the more flag or not.
Would that be possible? I can try to update the documentation as well, if someone could point where a note about it would fit better.
Thanks!
I used to generate links to previous/next post with pagination.prev_post/pagination.next_post. Both of them seem to not work with the latest code. Usage:
{% extends "default.html" %}
{% block footer %}
{% if pagination.prev_post %}
<a class="pagination" href="{{pagination.prev_post.url}}">« {{pagination.prev_post.title}}</a>
{% endif %}
{% if pagination.next_post %}
<a class="pagination" href="{{pagination.next_post.url}}">{{pagination.next_post.title}} »</a>
{% endif %}
{% endblock %}
sudo pip3 install piecrust
ends with Could not find a version that satisfies the requirement piecrust (from versions: 2.0.0-alpha1, 2.0.0-alpha2, 2.0.0-alpha3, 2.0.0-alpha4, 2.0.0a5, 2.0.0a6, 2.0.0a7, 2.0.0a8, 2.0.0a9)
sudo pip3 install --pre piecrust
works, but there are some issues with this version and flat hierarchy: going to bl.og/year/post-name results in:
%d format: a number is required, not NoneType
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/piecrust/serving.py", line 98, in _run_piecrust
response = self._try_serve_page(app, environ, request)
File "/usr/local/lib/python3.4/dist-packages/piecrust/serving.py", line 171, in _try_serve_page
route_metadata, MODE_PARSING)
File "/usr/local/lib/python3.4/dist-packages/piecrust/sources/posts.py", line 55, in findPagePath
'month': '%02d' % month,
TypeError: %d format: a number is required, not NoneType
On a vanilla and updated Debian install, when I create a new venv by default "wheel" is not included. As it turns out, Piecrust does not install properly unless "wheel" is installed. (All packages seem to be installed, but running chef commands results in some dependency conflicts.) In fact, "wheel" has to be installed first, and then running pip install piecrust
works as expected.
Perhaps I'm misunderstanding the documentation, but here's what I have:
/pages/teaching.html
/pages/teaching/child.html
Both have some content.
When I look at what is returned for family.children in the PieCrust debug info at localhost:8080/teaching?!debug, it is an empty array. Shouldn't I see the content from child.html in there? Am I doing it wrong?
PieCrust2 should accept the root being an empty string.
Please consider updating requirements.txt – more of the requirements are outdated versions.
Installing PieCrust2 on a Linux distro like ArchLinux breaks havoc: a pip install piecrust2
will uninstall newer versions and install outdated versions of packages that are already in ArchLinux. One example is pygments
: PieCrust2 wants version 1.6, but the current version available on pygments.org (and in ArchLinux) is 2.0.2.
Cheers.
For example:
pages/about.md: pcurl('') == '../'
pages/_index.md: pcurl('about') == 'about/'
I was trying to run the FoodTruck admin panel by my own, since there is no specific instruction to do that.
I created a new site using chef init
, then run chef admin init
and chef admin run
. I could hit the login page and put the admin user and password, but after that I only got an Internal Server Error. There is any other action I need to take to run the admin panel?
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [28/Jan/2016 22:36:32] "GET / HTTP/1.1" 302 -
127.0.0.1 - - [28/Jan/2016 22:36:32] "GET /login?next=%2F HTTP/1.1" 200 -
127.0.0.1 - - [28/Jan/2016 22:36:32] "GET /static/css/foodtruck.min.css HTTP/1.1" 404 -
127.0.0.1 - - [28/Jan/2016 22:36:32] "GET /static/js/foodtruck.min.js HTTP/1.1" 404 -
127.0.0.1 - - [28/Jan/2016 22:36:36] "POST /login?next=%2F HTTP/1.1" 302 -
Exception on / [GET]
Traceback (most recent call last):
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/flask_login.py", line 792, in decorated_view
return func(*args, **kwargs)
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/foodtruck/views/main.py", line 24, in index
site = g.sites.get(site_name)
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/foodtruck/sites.py", line 132, in get
root_dir = self.get_root_dir(name)
File "/home/thhg/workspace/piecrust/env/lib/python3.5/site-packages/foodtruck/sites.py", line 118, in get_root_dir
root_dir = scfg.get('path')
AttributeError: 'NoneType' object has no attribute 'get'
I try to access posts listing for one of categories with the latest git version. It works fine with tags, but fails with category.
categories.html looks like this:
---
title: Categories
description: Categories
layout: page
format: none
---
<ul>
{% for c in blog.categories %}
<li><a href="{{pccaturl(c.name)}}">{{c.name}}</a></li>
{% endfor %}
</ul>
_category.html looks like this:
---
format: none
---
<section>
{% for post in pagination.posts %}
{% include 'partial_post.html' %}
{% endfor %}
</section>
as at issue ludovicchabant/PieCrust#158 (comment) , you indicated in July 2015, the possibility that Piecrust2 compatibility with python 2.7 will be looked into.
Is there any chance that this was worked upon? :-)
Platform: Windows 7
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
[D:..\packages\PieCrust2]: git rev-parse H
2de541f
[D:..\packages\PieCrust2]: python .\setup.py build
Traceback (most recent call last):
File ".\setup.py", line 127, in
raise Exception("Can't get version from either a version file or "
Exception: Can't get version from either a version file or from the repository.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.