Source for my own homepage.
  • Python 30.9%
  • HTML 27.4%
  • CSS 24.1%
  • JavaScript 17.6%
Find a file
Johannes Ekberg 40f1535899 New Post
2013-08-31 22:43:18 +02:00
content New Post 2013-08-31 22:43:18 +02:00
modules And there's Paste in a Blueprint too 2013-06-04 22:52:08 +02:00
static Fixed-up Pastebin 2013-06-04 20:51:52 +02:00
templates Removed links 2013-08-31 22:43:03 +02:00
.gitignore New caching scheme to avoid collissions 2013-06-04 21:48:42 +02:00
common.py Error code cleanup 2013-06-04 23:00:54 +02:00
fileblog.py Removed links 2013-08-31 22:43:03 +02:00
home.py Error code cleanup 2013-06-04 23:00:54 +02:00
middleware.py Fix all the things! 2013-04-27 00:03:44 +02:00
README.md Added new dependency for the pastebin 2013-06-04 21:59:13 +02:00
wsgi.py Fix all the things! 2013-04-27 00:03:44 +02:00

About

This is what I use to run http://macaronicode.se.

Feel free to steal anything (especially fileblog.py) for yourself. There's no license.

Requirements

  • Python 2.7
    • flask
    • markdown2
    • jsonpickle
    • pygments

Idea

I'm not a big fan of databases. When I wrote the very first version of this site, I used a database, but it seemed silly and overkill for something that doesn't actually need to store more than static text. Static text is what you have static text files for, right?

So, I made a blog platform using only static text files. Posts are written using Markdown, metadata is stored using Markdown2's metadata extension, and are thus fully human-readable and safe from database corruption/crashes.

Post Syntax

Fileblog puts only one constraint on your post syntax: the first non-blank line (after an eventual metadata block) must be a title (underlined with =====).

Also, since file modification timestamps are rather fragile things (a simple touch or move is enough to reset it) and only Mac OS X stores creation time, Fileblog needs to store the timestamp in the file. This is done with a line like ! 27 Apr 2013, 15:14 inserted at the start of a file upon first viewing it.
I recommend you to create a blank file, view it to get an autogenerated timestamp, then open and edit it. Before publishing, remember to delete the old timestamp and view it to get a new one. And not to overwrite the new one by saving over it.

I get HTTP 500:s everywhere in production!

Make sure the cache directory is writable by the web server. It'll probably default to be writable only by you.