
A static website generator in Python - pajju
https://github.com/koenbok/Cactus
======
SnowLprd
I did some due diligence on static site generators at the beginning of the
year, first writing down my desired attributes:

* Actively maintained

* Supports Markdown

* Written in Python

* Flexible templating system

* Supports RSS/Atom feeds

* Supports syntax highlighting

* Track history (been around for at least a year)

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: <http://getpelican.com/>

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!

~~~
laktek
Have you tried Punch? <http://laktek.github.com/punch>. (and yes, I'm the
creator).

It will fit into all your requirements and has been there for almost a year
now.

~~~
antrix
> * Written in Python

Isn't punch a nodejs app?

~~~
jamesbritt

        * Download and Install Node.js.
        * Install Punch npm install -g punch
    

Seems so.

------
semenko
Just a general plug for the Flask framework: <http://flask.pocoo.org/>

A lot of you are probably familiar with Flask and its awesome Jinja2
templating system.

There's a well supported, officially approved extension called Frozen-Flask
that generates static sites from a Flask/Jinja2 deployment:
<http://packages.python.org/Frozen-Flask/>

~~~
alsocasey
Assuming one were looking to create a simple static file from scratch (e.g. a
personal blog), why would one select Frozen-Flask over a traditional static
site engine?

If you are familiar with building sites with Flask, I can obviously see the
appeal, but for someone unfamiliar with Flask, is there any advantage to going
the Frozen-Flask route over simply using a static site generator and content
stored as flat markdown? One of the selling points of static sites for me was
not having to include a database layer for something as simple as a personal
blog with a few dozen entries that I wish to serve.

~~~
smackay
It's probably worthwhile to point out the distinction between general
frameworks for static page generation and those that are designed for blogs.
Overall the supported features are similar with the only difference being the
amount of code that needs to be written and how opinionated the framework is
regarding the project structure. This latter point pretty much defines whether
a particular framework will work for your project.

I have a static site, which is published in two languages, currently with over
5000 pages and about 50 page updates and new pages added per day. None of the
static blog frameworks were flexible enough even though my requirements are
pretty minimal. I ended up using <https://github.com/mtigas/django-medusa/>
with a custom app, <https://github.com/StuartMacKay/django-sitepaths> to
manage all the pages and allow pages to be easily regenerated. This works
well, with little tinkering to keep it working however I'd certainly take a
closer look at Frozen-Flask for my next project.

------
shazow
I also published my own static website generator. (Excuse my albeit-related
shameless plug.)

<https://github.com/shazow/composer>

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.

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.

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.

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.

------
JeffJenkins
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.

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.

And vaporfile works pretty well for uploading the finished site to S3:
<https://github.com/enigmacurry/vaporfile>

------
akavlie
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.

~~~
koenbok
Author here. I haven't looked too much at Pelican, but Cactus was built for
designers (eg. be simple). The goal was to get them from nothing to a fully
hosted site on s3 in under a minute.

------
jokull
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>CSS, Coffee>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. <https://github.com/jokull/jinjet>

Warning: Not good for blogging or anything you would like to update often.

I’ve also tried Flask-Freezer for static sites. All the benefits of regular
frameworks.

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.

------
spitfire
Do any of these static site generators support A/B testing (probably via some
JS)?

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.

~~~
urlwolf
Agreed. This would be a killer feature. Right now the options you have is to
do everything server side (say django-lean) or use one of the commercial
options (optimizely). Not ideal.

My money on the static site generator race is on docPad.

~~~
gwern
The most painful part is that you _used_ to be able to use Google Website
Optimizer as a static-site-wide a/b tester. I was doing just that on my own
(Hakyll-generated) site, gwern.net, and half-way through Google shut it down,
and replaced it with some crippled thing in Google Analytics.

------
jordanmessina
Nice work. I really like the simple deployment aspect.

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
([https://docs.djangoproject.com/en/dev/topics/testing/#module...](https://docs.djangoproject.com/en/dev/topics/testing/#module-
django.test.client)) 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.

------
mrhonza
Here is my static site generator in Python: socrates.
<http://honza.ca/socrates/>

Jinja2 templates; write in md, rst, textile; sphinx syntax highlighting; yaml
config; compatible with s3 and github pages; atom feed.

~~~
thurloat
I converted my WP hosted blog over to socrates last year. Very familiar and
enjoyable environment being someone who does python, and served up using
GitHub pages. :)

------
peterjmag
Not to beat a dead horse with yet another recommendation, but here's what I'm
using for my own site: <https://github.com/Ceasar/staticjinja>

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.

------
hardik988
I personally use Jekyll for my own blog - because I spent a lot of hours
setting it up, and now it _just works_.

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.

It uses a custom markup language that supports a couple of great features:
optional per-page configuration, executing scripts through a nifty <exec> tag,
and the script's output is placed in the web page. I use this to run a BSD
fortune script[2]!

[0]: <http://www.hardikr.com>

[1]: <http://tastytronic.net/asciiweb/aw.cgi>

[2]: <http://www.hardikr.com/aw.cgi?main=fortune.rfk>

------
zobzu
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)

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

~~~
jwandborg
> 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)

I have initiated work on talkatv (<http://talka.tv>).

It's written in Python using Flask. You might find it useful and I hope you'll
be able to help me expand it, since I havent found much time to do so myself.

~~~
sdoering
That's interesting. I once (some time ago) tried juvia
(<https://github.com/phusion/juvia>), as comments are a problem for me, 'cause
I try to be as much self-contained, as I can be.

But on my host, it was not that easy to setup, and I am not that much of a
rails guy. So a python-based alternative might fit me better.

I'll have a look.

------
unoti
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?

~~~
smacktoward
Yes. It's called Movable Type.

<http://www.movabletype.org/download.html>

If you wait long enough, everything old becomes new again :D

------
danso
How's this compare to Ruby's Jekyll and Octopress?

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.

~~~
wting
I used Jekyll up until 7 months ago before switching to Pelican and blogged
about it here:

[http://blog.williamting.com/posts/2012/05/30/migrating-
from-...](http://blog.williamting.com/posts/2012/05/30/migrating-from-jekyll-
to-pelican/)

tldr: Wanted to mess around with internals, but rather than learn Ruby I
switched to a Python-based platform instead. I've learned Ruby since then, but
only at a surface level of comprehension.

------
koenbok
Here is a simple example project for a blog:
<https://github.com/koenbok/CactusBlog>

------
human_error
Do we really need another one? What's the point of creating these static
website generators in Python?

------
nXqd
what is the application he uses to copy amazon key in the screencast :
<http://vimeo.com/46999791>

~~~
mattwidmann
LaunchBar at <http://www.obdev.at/products/launchbar/index.html>

------
danjessen
Looks good i might have to check it out

