I have majorly changed my blog here yet again! Only this time I'm not breaking all the links. What did I do this time? I took it all off of django (nothing wrong with django, just my use of it) and moved everything over to... flat pages!!! A step backwards? That's what I thought at first...
Over the past year I've expressed my designer to be able to create small dynamic websites easily and have them easy to setup on a server and run fast. It wasn't until about a month ago that that happend. Matthew (my brother) woke me up early in the morning (I was already 1/5 of the way awake) to tell me about what he had been thinking about all night. Besides a totally awesome stats program of my dreams (he likes to do this, I tell him what I want and he comes up with a really cool way of making it) a solution to my easy small dynamic website problem. Pype! (link coming soon).
The idea isn't really new, but it's never been implemented this well. Basically I create a project directory for my website, create directories within that for site sections, and then html or rst [1] documents for the pages. But that's not all there is to it obviously because that's just totally not dynamic. The dynamic part comes in with the path.ini files. I can place a path.ini file inside a directory and specify templates for for documents, indexes, and all that good stuff.
Pype uses django templating, so I can still use that which is really nice. An example of using these templates are the posts. Each post is a single rst document. That rst document is then converted to html and passed on to the template specified in the path.ini.
My blog index is an example of the index section in the path.ini file. I tell pype to pass to my post index template a list of all rst documents found at certain locations (specified with regular expressions). So I got all the posts to go to the index by using "d{4}/d{2}/.+". Then in that directory I have a dir for all the years, then in that for all the months, and then in there the posts. And it comes out how you see it on this site! I run it through the pype exporter and get it as a nice collection of flat html pages that, if you didn't know any better, would think was put together dynamicly at your request. Serving up flat html pages is very fast and stable, unlike websites driven by databases and scripting languages. And whenever I add a new post or page or what ever, I just re-run the export script (I'll eventually get it set up to do it automatically).
It sounds a lot harder than it is. I can now make a small dynamic website without having to write a single line of code (as long as you define code as python, php, ruby, etc) or worry about maintain a database! I can change the structure of or add or remove anything and it all works out beautifully. It is also very easy to develop my website offline and have it be the exact same thing as it is online. This is very important for me because I don't have internet more than once every two days!
| [1] | reStructuredText |
