Because that's exactly what the world needs
Ok, I finally took the time to upload this blog and put to use this domain name (that thing full of consonants is my surname). There are still a zillion details to tweak on the HTML (e.g., the excessive space on the bottom of the page, or the whole responsive design thing (it is pretty buggy yet, but ok for now)). Anyway, if there is one thing I whole-heartly believe in, apart from Nicola Tesla's awesomeness, is incremental development.
I made this blog, mostly, to get some experience with Mezzanine, a blog/CMS built on top of Django, the best framework for web development in Python. Or I should say, the best framework for web development, period.
I've read somewhere that "a blog is the new hello world", regarding tutorials, so let's talk a little about Mezzanine...
Mezzanine attempts to be a Wordpress alternative, a blog system that can be set-up quickly by non-developers. Although, I'm not sure if it can be used professionally by someone without any knowledge of programming, I think you need at least some basics of Django (and A LOT of Python, in order to grok the basics of Django). There's no Python answer to Wordpress yet, but Mezzanine is the closest thing so far (and pretty close).
Mezzanine is truly great. It's not a Django app, rather a set of apps that, together, bring to life the most pleasant CMS I ever worked with. It works just as a Django app and integrates perfectly with anything you create in Django.
It comes bundled with almost every feature a common site needs (including, of course, the ones that already come with Django, as the excellent admin panel), as login/user pages, picture upload and gallery, a pretty complete blog app, SEO friendly URLs, integration with Google Analytics, Disqus, Twitter, bit.ly, and so on. Installing is as simple as "pip install mezzanine", and it comes with most of the "mandatory" Django apps as requirements: South, for database migrations; Fabric, for deploy; PIL for working with images; and much more. Actually, South is optional, but highly recommended. You better check if south is installed before creating you first Mezzanine website. Or just run "pip install south". To sync the database, use "python manage.py createdb" (not syncdb), so the initial fake migrations will be automagically done by Mezzanine.
In fact, I had a lotta trouble with PIL... Simply couldn't install it on a Windows machine... But installing PIL on Linux is pretty simple: Just install all basic python development tools:
$ apt-get install build-essential python-dev python-all-dev python-profiler
In order to test it, just run:
>>> import PIL
>>> from PIL import Image, _imaging
If at this point there's no error, you're fine, all libraries were found (if PIL don't find jpglib, he won't import _imaging). This prompt could be used to do some actual testing, as resizing an image, but just finding them seems to be enough.
The example mezzanine page has an index, an about, a blog, a contact form page, and some others (obviously they are easy to create/delete/edit). I checked on it a lot while turning this HTML i'm using into a template. To use the blog as the index, I simply changed the standard URL regular expression (don't worry, that's pretty easy to do, as the authors already predicted most customizations and added them as comments to url.py).
As a brazilian, I had to remove non-american characters from the URLs (my server was complaining about them). To do so, I made a custom function that switches unwanted characters for the "standard" version (e.g., ação becomes acao). The function is called after the URL is made but before it is saved, by the class Slugged (every object that gets an URL inherits from this class; a slug is a name or sentence turned into URL format, that is, without spaces (and now, without weird letters too)).
I didn't know that the Twitter feed needs a scheduled cron job. The Fabric script already creates this job, but I didn't deploy with Fabric (yeah, stupid), so I ran:
$ crontab -e
And added the following line at the bottom of the page:
*/10 * * * * python path/to/your/site/manage.py poll_twitter
This way, the command "python manage.py poll_twitter" will run every 10 minutes and update your tweeter feed. Yay! But you better do it the proper way and use Fabric. It rocks.
Well, if you code in Python, you definitely should take a look at Mezzanine for your blogging or CMS needs. In the future I'll post more about my experiences with it.