Getting Markdown to work with Django
In your view template put:
{% load markup %}
In your settings.py in the INSTALLED_APPS section, put:
'django.contrib.markup',
Install the Markdown library:
Install on OS X:
Download markdown.py and setup.py and run:
python setup.py install
This is what happened on my system:
running install
running build
running build_py
creating build
creating build/lib
copying markdown.py -> build/lib
running install_lib
copying build/lib/markdown.py -> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages
byte-compiling /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/markdown.py to markdown.pyc
I wonder if that was the wrong way to do that. It looks like it modified my system version of Python, which means if the system updates it, it will be overwritten, right?
Install on DreamHost
Basically, you just want to put the markdown.py file anywhere in your Python path. The simplest way is to just drop markdown.py in your django_projects directory. A slighty more complicated, but cleaner way (and actually the way I did it) is to create another directory for Python modules like this. I created a directory at the root of my Dreamhost account called “pylib”. You then need to add this directory to your python path by adjusting .bashrc and django.fcgi accordingly. If that makes sense, go for it. If not, just drop markdown.py in your django_projects — that’ll work fine.
Comments
I just found this site, and have just been through the process of installing markdown, textile and (unsuccesfully) smartypants myself. I’ve found it really hard to find good, simple-to-follow instructions of how to install certain things for Django, so I’ll be bookmarking this site to find out how you approached them!
I spent most of yesterday trying to get PIL installed, no mean feat for a complete Python noob like myself. After a few failed attempts I eventually found this walk-through to be the most helpful (only good if you’re running OSX 10.4+)
What do you think about that?