Django-Mingus Blog On Heroku
Who wants a free self-hosted blog – raise your hand. Well, almost free, I did have to pay for the domain name.
I decided this past weekend to move this blog from Tumblr to my own platform. I used it as an excuse to play with some technologies I’ve been wanting to ramp up on. Specifically Django and Heroku, so beware, if you decide to follow in my footsteps understand that my choices are likely not the most sound choices, and you might be better off with a standby like Wordpress or even Jekyll (which seems to be a popular choice at the moment). /disclaimer
Going into this I thought the biggest difficulty I would face would be choosing among all of the Django-based blog platforms that surely were out there. Boy was I wrong. While there are many tutorials for creating your own blog in Django I didn’t want to role my own. Surprisingly, I only managed to find a few somewhat active Django blog projects and among the ones I found Mingus seemed to be my best bet.
After a somewhat impulsive selection, I got right to work installing it locally. That was relatively easy, I just ran into one issue. Mingus has a dependency of Django-db-log which doesn’t seem to be an active project any longer and apparently doesn’t work right with Django 1.3.1. The Github project points to a successor but I didn’t try to implement it. Instead I opted to just remove the database logging functionality. I may regret it later, but I doubt it.
With the aforementioned tweak to the dependencies and some other fiddling it was up and running locally. Once that was established I got to work on ramping up with Heroku. I had never done anything with that platform before so I was starting from square one. Luckily they have an excellent getting started document which brought me up to speed in short order.
Despite the excellent getting started guide, I ran into the only significant snag in this whole project when I tried to deploy to Heroku. Apparently when running the script to install dependencies you can’t point to a Subversion repository and mark it as editable (with an “-e” flag). Heroku was returning “svn command not found.” Mercurial and Git were no problem however, so I ended up submitting a support ticket. It took a couple of day (I had to wait until Monday) to get a response, but with that flag removed it worked without problem.
In order to easily share the changes I made to the project I forked it on Github and the instructions below pull from that repository. For your reference the original repository can be found at Github.That’s enough background. Without further ado here are the instructions that should get Mingus deployed on Heroku for you. These assume you have some familiarity with virtualenv, pip and Heroku. It also assumes you have those installed as well as Python 2.7.
To get it running locally:
- mkdir blog && cd blog
- virtualenvvenv –distribute -p python2.7
- source venv/bin/activate
- pip install mercurial (only if you don’t have it)
- git clone git://github.com/jnorthrop/django-mingus.git
- cd django-mingus/mingus/
- pip install -r heroku-requirements.txt
- mv local_settings.py.template local_settings.py
- ./manage.py syncdb
- ./manage.py loaddata test_data.json
- ./manage.py runserver (check that it works)
To install it at Heroku:
- cd blog/django-mingus
- cpmingus/heroku-requirements.txt requirements.txt
- git add .
- git commit -m “Initial Mingus install"
- heroku create –stack cedar
- git push heroku master
- heroku run mingus/manage.py syncdb
- heroku run mvmingus/local_settings.py.template mingus/local_settings.py
- heroku run mingus/manage.py loaddata test_data.json (if you want the test data)
You should now have a Mingus installation running on Heroku. Congratulations!