I’m trying to use Markdown with Django as shown in this tutorial. I’ve got the library installed and configured in Django using django.contrib.markup, but when I go to a page using markup, I get:
Error in 'markdown' filter: The Python markdown library isn't installed.
Then, through the interpreter I try running import markdown, which results in the following traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/markdown/__init__.py", line 43, in <module>
from .treeprocessors import build_treeprocessors
File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 2, in <module>
from . import inlinepatterns
File "/usr/lib/python2.7/site-packages/markdown/inlinepatterns.py", line 47, in <module>
from urllib.parse import urlparse, urlunparse
ImportError: No module named parse
The Python documentation, however, tells me that urlparse has been renamed to urllib.parse in Python 3, which doesn’t make any sense, because the Markdown library was installed through pip2, which put in into the python2.7 site-packages directory.
Changing that one line, by the way, results in more import errors.
No idea how this happened, but reinstalling Markdown worked. In retrospect, I probably should have tried that first.