TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A static website generator in Python

140 pointsby pajjuover 12 years ago

18 comments

SnowLprdover 12 years ago
I did some due diligence on static site generators at the beginning of the year, first writing down my desired attributes:<p>* Actively maintained<p>* Supports Markdown<p>* Written in Python<p>* Flexible templating system<p>* Supports RSS/Atom feeds<p>* Supports syntax highlighting<p>* Track history (been around for at least a year)<p>The above list seemed like a good place to start, and after going through all the various candidates, the one that met all my criteria was Pelican. I liked the project and its author enough to eventually join the team as a committer. Check it out at: <a href="http://getpelican.com/" rel="nofollow">http://getpelican.com/</a><p>Cactus looks interesting, but I prefer having a wider range of deployment targets (instead of just S3). I also prefer the Jinja templates that Pelican uses instead of Cactus' Django templates. Just my two cents, of course. All of the various static site generators bring something interesting to the table — the more the merrier!
评论 #4859212 未加载
评论 #4858818 未加载
评论 #4859829 未加载
评论 #4859563 未加载
semenkoover 12 years ago
Just a general plug for the Flask framework: <a href="http://flask.pocoo.org/" rel="nofollow">http://flask.pocoo.org/</a><p>A lot of you are probably familiar with Flask and its awesome Jinja2 templating system.<p>There's a well supported, officially approved extension called Frozen-Flask that generates static sites from a Flask/Jinja2 deployment: <a href="http://packages.python.org/Frozen-Flask/" rel="nofollow">http://packages.python.org/Frozen-Flask/</a>
评论 #4858942 未加载
shazowover 12 years ago
I also published my own static website generator. (Excuse my albeit-related shameless plug.)<p><a href="https://github.com/shazow/composer" rel="nofollow">https://github.com/shazow/composer</a><p>Composer is framework for building your own static site generator. It's not opinionated about what kind of website you want, or which templates you want to use, or what kind of pre/post processing you want to do, etc.<p>For example, shazow.net is composed by pulling metadata from a git repo and using author/timestamps those as variables in each Mako template container for Markdown+Pygments processed text.<p>Composer comes with a bunch of pre-built filters for convenience (Mako, Markdown, Jinja2, RST, Pygments—adding your own is bordering trivial), a site compiler and auto-reloading server, and some other reusable components.<p>If you're interested in doing something completely custom, this might be a good starting point. I haven't worked on it in several months but I like the core philosophy and design—I think others might too. Forks and pull requests welcome.
JeffJenkinsover 12 years ago
I've been very happily using Blogofile. It's what Mike Bayer uses for SQLAlchemy. There's a built in blog engine, and it uses Mako templates, which are significantly better than the django ones.<p>It also by default will recognize multiple formats (e.g. markdown, mako, plain html) for rendering and you can embed markdown inside of the mako templates.<p>And vaporfile works pretty well for uploading the finished site to S3: <a href="https://github.com/enigmacurry/vaporfile" rel="nofollow">https://github.com/enigmacurry/vaporfile</a>
akavlieover 12 years ago
It would be great if someone (esp. the generator's authors or users) could comment on how this is different than the other Pythyon static site generators, such as Pelican. Based on the docs, it appears that it's built with easy deployment to S3 in mind.
评论 #4858777 未加载
jokullover 12 years ago
I have a weird approach to this problem that someone might like. I use Brunch, which is a frontend assembler (like Yeoman but with more flexibility). I then use a Jinja2 watcher utility over the output directory. So one watcher does Stylus&#62;CSS, Coffee&#62;JS, minifying, concat etc., and the other one is for the template stuff. I wrote a simple utility for the templating part, which can output site translations too if you want. <a href="https://github.com/jokull/jinjet" rel="nofollow">https://github.com/jokull/jinjet</a><p>Warning: Not good for blogging or anything you would like to update often.<p>I’ve also tried Flask-Freezer for static sites. All the benefits of regular frameworks.<p>Cactus has some nice things going for it, but some decisions are weird. May I suggest using Jinja2 for templating, Django is complete overkill and simply an inferior template engine. Oh and make it at least somewhat PEP8 compatible.
spitfireover 12 years ago
Do any of these static site generators support A/B testing (probably via some JS)?<p>That's the real thing that I see missing in a lot of CMS's. If I could setup A/B tests right in markdown and easily post the results somewhere(A bit tricksy, yes), that would simplify operations hugely for a great many people.
评论 #4860571 未加载
评论 #4859179 未加载
评论 #4860317 未加载
评论 #4859238 未加载
jordanmessinaover 12 years ago
Nice work. I really like the simple deployment aspect.<p>I've been working on a static site generator as well, but with a twist. My issue has always been having to learn a brand new framework and set of commands to simply generate a static site. I already know Django very well, so I built a static site generator on top of it. I just use the Django test client (<a href="https://docs.djangoproject.com/en/dev/topics/testing/#module-django.test.client" rel="nofollow">https://docs.djangoproject.com/en/dev/topics/testing/#module...</a>) to dump the static content to a folder. I have some markdown helpers too, so all posts can be written in markdown and live in some folder at the root of the project. I have a few more things to finish with it, if anyone's interested I can throw it on Github.
mrhonzaover 12 years ago
Here is my static site generator in Python: socrates. <a href="http://honza.ca/socrates/" rel="nofollow">http://honza.ca/socrates/</a><p>Jinja2 templates; write in md, rst, textile; sphinx syntax highlighting; yaml config; compatible with s3 and github pages; atom feed.
评论 #4868192 未加载
peterjmagover 12 years ago
Not to beat a dead horse with yet another recommendation, but here's what I'm using for my own site: <a href="https://github.com/Ceasar/staticjinja" rel="nofollow">https://github.com/Ceasar/staticjinja</a><p>Very simple, but perfect for my needs. Granted, I haven't added a blog yet, but it looks like it'll be pretty easy when I get around it it.
hardik988over 12 years ago
I personally use Jekyll for my own blog - because I spent a lot of hours setting it up, and now it <i>just works</i>.<p>However, for my homepage[0], I use Asciiweb[1], a - As a fan of ASCII art, I'm really happy with it. It's great for a static homepage, though not that great for blogging.<p>It uses a custom markup language that supports a couple of great features: optional per-page configuration, executing scripts through a nifty &#60;exec&#62; tag, and the script's output is placed in the web page. I use this to run a BSD fortune script[2]!<p>[0]: <a href="http://www.hardikr.com" rel="nofollow">http://www.hardikr.com</a><p>[1]: <a href="http://tastytronic.net/asciiweb/aw.cgi" rel="nofollow">http://tastytronic.net/asciiweb/aw.cgi</a><p>[2]: <a href="http://www.hardikr.com/aw.cgi?main=fortune.rfk" rel="nofollow">http://www.hardikr.com/aw.cgi?main=fortune.rfk</a>
zobzuover 12 years ago
The major problem with all static generators is that, by design, they can't host comments. And using a 3rd party source for comments ain't exactly what I'd be looking for (self-contained)<p>The minor problem is that all the ones I used so far are a lot more complex to use that dynamic generators, for some reason. (Even thus I write templates, css, etc for the dynamic ones as well). It seems like a "it has to be complex" syndrome :p
评论 #4859105 未加载
评论 #4859177 未加载
评论 #4861903 未加载
unotiover 12 years ago
I'd like to see a static site generator that still runs some kind of administrative backend somewhere. Then I could have clients or friends I do sites for log in to one of my personal machines and enter new stories/content, and it would generate the pages and push the updates. That would combine the best of a simple CMS with the best of static generation. Does something like this already exist?
评论 #4859655 未加载
dansoover 12 years ago
How's this compare to Ruby's Jekyll and Octopress?<p>I think static site generators are pretty great...especially if you have a decent grasp of JS frameworks. According to the recent HN front page submission, Obama's $250 million fundraising site was run off of Jekyll.
评论 #4858927 未加载
koenbokover 12 years ago
Here is a simple example project for a blog: <a href="https://github.com/koenbok/CactusBlog" rel="nofollow">https://github.com/koenbok/CactusBlog</a>
human_errorover 12 years ago
Do we really need another one? What's the point of creating these static website generators in Python?
nXqdover 12 years ago
what is the application he uses to copy amazon key in the screencast : <a href="http://vimeo.com/46999791" rel="nofollow">http://vimeo.com/46999791</a>
评论 #4858760 未加载
danjessenover 12 years ago
Looks good i might have to check it out