Installing Markdown (Python)

apps

#1

I’m having some trouble getting Markdown installed for use in a Django app. Has anyone done this before? I downloaded the source from http://pypi.python.org/packages/source/M/Markdown/Markdown-2.0.tar.gz and attempted to install. I used python setup.py install --prefix=$HOME to no avail.

Any help would be great!

Thanks.


#2

Well, I figured it out - thought I’d post my answer for the next guy trying to do the same thing*.

(I assume you already have Django up and running on your domain, and you have already added ‘django.contrib.markup’ to your INSTALLED_APPS and applied the filter to your template)

Follow the instructions to install virtualenv (here): wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.4.5.tar.gz tar xzf virtualenv-1.4.5.tar.gz python2.4 virtualenv-1.4.5/virtualenv.py $HOME/local

Then go ahead and install Markdown: easy_install Markdown

Check (via the command line) to make sure markdown installed. Start python and run: import markdown

Once you have everything configured cd into your domain directory and open up passenger_wsgi.py in your favorite editor.

Add these two lines under the second line:myPath = os.environ['HOME'] + '/lib/python2.5/site-packages/' sys.path.insert(0, myPath)

The file should look like this:import sys, os sys.path.append(os.getcwd()) myPath = os.environ['HOME'] + '/lib/python2.5/site-packages/' sys.path.insert(0, myPath) os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings" import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()

Then open up your browser and everything should be ready to go.

  • If you follow these directions and something breaks - DH support won’t be able to help you. So make sure you’re prepared to troubleshoot.