Ratonland V4

Here we go again .oO(♬ Shelter - Here We Go ♬), once again, a new version of the website.

Thanks to the wayback machine I managed to get a few screenshots of the previous versions

2004 - V1

Using lanewfactory in PPH and storing data in xml.

v1

2006 - V2

Custom php made, with a postgres for storage.

v2

2013 - V3

Custom django made project, using sqlite for storage.

v3

2018 - V4

That's what you're looking at, it is using pelican and hosted on gitlab. I'm using the bootstrap2-dark theme.

It was fairly easy to get it working, but I did waste some time when I tried to import the articles from V3...

As mentionned above V3 was on django+sqlite, with articles written in markdown. At first I tried to export the data in csv and tried to parse that in shell to generate the content for pelican...

And at some point I realized that was stupid, why not simply do it in python? I fired up ipython, and 2 minutes later it was done.

import sqlite3

db = sqlite3.connect('./raton.db')
c = db.cursor()

for pub_date, title, content, tags in c.execute('select pub_date, title, content, tags from news_post'):                                                                                                 
    f = open("output/%s--%s.md"  % (pub_date.replace(' ', '_'), title.replace(' ', '_').replace('/', '-')), 'w+')                                                                                        
    f.write("Title: " + title + "\n")
    f.write("Date: " + pub_date + "\n")
    f.write("Tags: " + tags + "\n")
    f.write("\n")
    f.write(content)
    f.close()

And that's it.