how to use django markdown in my blog -
at first install django markdown
pip install django-markdown
than add django-markdown in setting.py file
installed_apps = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog', 'django-markdown', ]
then, change urls.py as:
from django.conf.urls import include, url django.contrib import admin resume import views urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^home/$', views.home, name='home'), url(r'^blog/', include('blog.urls',namespace='blog',app_name='blog')), url('^markdown/', include('django_markdown.urls')), ]
i change admin.py file as:
from django.contrib import admin .models import post django_markdown.admin import markdownmodeladmin class postadmin(admin.modeladmin): list_display = ('title','slug','author','publish','status') list_filter = ('status','created','publish','author') search_fields = ('title','body') prepopulated_fields = {'slug':('title',)} raw_id_fields = ('author',) date_hierarchy = 'publish' ordering = ['status','publish'] # register models here. admin.site.register(post,markdownmodeladmin, postadmin)
but, when start runserver, django gives me error this:
modulenotfounderror: no module named 'django-markdown'
how can solve problem?
in installed apps should add django_markdown
instead of django-markdown
Comments
Post a Comment