How can I satisfy a django.contrib.markup.templatetags.markup import restructuredtext in django 1.6?

StackOverflow https://stackoverflow.com/questions/20055603

Question

Wondering which restructured package most of you use in django 1.5+?

from django.contrib.markup.templatetags.markup import restructuredtext

Returns:

ImportError ...
No module named markup.templatetags.markup

https://docs.djangoproject.com/en/1.6/releases/1.5-alpha-1/#django-utils-markup

Était-ce utile?

La solution

Yes the django.utils.markup was deprecated in 1.5 and removed in 1.6. The Python implementation of the reStructuredText markup lives in the docutils package. That is the implementation that Django <= 1.5 used.

The easiest way to install docutils is using pip:

pip install docutils

You can find the old django.utils.markup implementation in the 1.5.x branch on Djangos github repo:

https://github.com/django/django/blob/stable/1.5.x/django/contrib/markup/templatetags/markup.py#L76

Autres conseils

This is an addon to the answer by @jbub:

When you have an old Django application and you want to continue using markup, follow these steps:

Note that this procedure keeps your old application working. However, the deprecation of django.contrib.markup came for a reason: There were security concerns over possible cross-site scripting attacks using markdown. You are on your own to deal with this problem.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top