I'm having trouble using Markdown in Django Nonrel. I followed this instructions (added 'django.contrib.markup'
to INSTALLED_APPS
, include {% load markup %}
in the template and use |markdown
filter after installing python-markdown) but I get the following error:
Error in {% markdown %} filter: The Python markdown library isn't installed.
In this line:
/path/to/project/django/contrib/markup/templatetags/markup.py in markdown
they will be silently ignored.
"""
try:
import markdown
except ImportError:
if settings.DEBUG:
raise template.TemplateSyntaxError("Error in {% markdown %} filter: The Python markdown library isn't installed.") ...
return force_unicode(value)
else:
# markdown.version was first added in 1.6b. The only version of markdown
# to fully support extensions before 1.6b was the shortlived 1.6a.
if hasattr(markdown, 'version'):
extensions = [e for e in arg.split(",") if e]
It seems obvious that import markdown
is causing the problem but when I run:
$ python manage.py shell
>>> import elementtree
>>> import markdown
everthing works alright.
Running Markdown 2.0.3, Python 2.7 and latest version of Django Nonrel.
UPDATE: I installed textile and it doesn't work. It produces the same error.
UPDATE 2: This is an issue related with Django Nonrel. I took an older Django project (1.3.1), and works as expected.
Ideas?
Thanks!
Alright, newbie mistake.
Turns out that Django Nonrel couldn't find markdown because for some reason, it wasn't installed in a python path it was looking for. In this case, markdown was installed in /usr/lib/pymodules/python2.7
instead of /usr/local/lib/python2.7/dist-packages/
or some other usual place. So I copied the markdown folder to a place listed by python path, and the error went away.