1

I am going over the documentation for using django-markdown2 in Project1, and I don't know what is the best way to:

-'Place django_markdown2 somewhere in your PYTHONPATH.'

https://github.com/svetlyak40wt/django-markdown2

I am using forms to pass the variable 'content' to read the .md modules.

class CreatePageForm(forms.Form):
    title = forms.CharField(max_length=50,
                            widget=forms.TextInput(
                                attrs={"class": 'content',
                                       "placeholder": "Type title",
                                       }))

    content = forms.CharField(widget=forms.Textarea(
        attrs={"class": 'content',
               "placeholder": "Type content",
               'rows': 20,
               'cols': 80}))

this is what I have in the template:

{% extends "encyclopedia/layout.html" %}
{% load md2 %}

{% block title %}
{{ title }}
{% endblock %}

{% block body %}
<div class="content-markdown">
    {{ content|markdown }}
</div>
<br>
<a href="{% url 'edit' title %}">Edit</a> <br>
{% endblock %}

I need to know how I can place django_markdown2 in my PYTHONPATH and make it work with the forms I created, if it is possible how it should be done

Maska
  • 11
  • 1

1 Answers1

0

I had the same problem and I wrestled with it for over a day. The instructions for updating the PYTHONPATH are outdated. Their is no longer any need to edit the PYTHONPATH. The core of the misunderstanding is that django_markdown2 and markdown2 are seperate packages to be installed seperately as described in This answer.

to install django-markdown2 in your current environment, run

pip install django-markdown2

and forget about manually downloading anything or modifying PYTHONPATH.

Then, once the library is installed, change your settings.py to include django_markdown2 in your INSTALLED_APPS.

It is very unintuitive to have markdown in 2 seperate apps. Common sense would imply one package being included in the other. Markdown2 without tag functionality substantially limits its utility. I will ask the said sources to update their info to point out that at this time django_markdown2 and markdown2 are seperate packages and each have to be installed seperately.