第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Django使用內(nèi)置comment的問題

Django使用內(nèi)置comment的問題

搖曳的薔薇 2019-02-26 08:53:33
Django:1.7.1 Python:2.7.8 使用的 https://github.com/django/django-contrib-comments,按照的使用指南做的: setting.py里寫的: INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'django_comments', 'cm', ) SITE_ID = 1 現(xiàn)在遇到了CSRF verification failed. Request aborted.問題,我點(diǎn)擊提交后,提示: Forbidden (403) CSRF verification failed. Request aborted. Help Reason given for failure: CSRF token missing or incorrect. In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function uses RequestContext for the template, instead of Context. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. You're seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting. post.html里面的代碼如下: {% extends "base.html" %} {% block title %}文章頁(yè) {% endblock %} {% block content %} <article id="post_content"> <h1>{{post.post_title}}</h1> <div class="meta">發(fā)布時(shí)間:{{post.post_date}}</div> <div class="content"> {{ post.post_content }} </div> </article> {% load comments %} <div> {% render_comment_list for post %} {% render_comment_form for post %} </div> {% endblock %} comments文件夾里面的模板都是從Django-1.7.1-py2.7.egg\django\contrib\comments\templates復(fù)制出來(lái)的。
查看完整描述

1 回答

?
元芳怎么了

TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超7個(gè)贊

lz,你的'django_comments' 'cm',中間少了一個(gè)逗號(hào),他把你這兩個(gè)當(dāng)成一個(gè)模塊名了,所以會(huì)出現(xiàn) No module named django_comments cm

查看完整回答
反對(duì) 回復(fù) 2019-03-01
  • 1 回答
  • 0 關(guān)注
  • 1141 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)