图片没有显示为django-simple-captcha

时间:2017-06-07 18:09:30

标签: python html django django-forms

我正在使用django-simple-captcha为网页上的不同联系人按钮制作验证码。我认为除了验证码won't show up.

的图像这一事实外,我都能正常工作

urls.py:

from django.conf.urls import url
from django.conf.urls import include
from . import views

urlpatterns = [
    url(r'^$', views.product_landing, name='product_landing'),
    url(r'(?P<product_slug>.*)/?$', views.product_detail,            
    name='product_detail'),url(r'^captcha/', include('captcha.urls'))
]

html for page:

</form>
{% else %} {% if is_valid %}
<div style="margin-top: 70px; margin-bottom: 200px;">
  <h1 style="margin-bottom: 25px">Thank you!</h1>
  <p style="font-size: 17px; line-height: 32px;;">Your resume has been received and we will be in touch with a decision soon. Please contact us if you have any questions.</p>
</div>
{% else %}
<form action="" method="POST" id="apply-form" enctype="multipart/form-data" class="application-form">
  {% csrf_token %}
  <div class="firstname {% if form.first_name.errors %}form-error{% endif %}">
    <p>FIRST NAME</p>
    {{ form.first_name }}
  </div>
  <div class="lastname {% if form.last_name.errors %}form-error{% endif %}">
    <p>LAST NAME</p>
    {{ form.last_name }}
  </div>
  <div class="email {% if form.email.errors %}form-error{% endif %}">
    <p>EMAIL</p>
    {{ form.email }}
  </div>
  <div class="phone {% if form.phone.errors %}form-error{% endif %}">
    <p>PHONE</p>
    {{ form.phone }}
  </div>

  <div class="resume-container {% if form.resume.errors %}form-error{% endif %}">
    <p>ATTACH PDF RESUME</p>
    <input class="readonly" type="text" READONLY>
    <div class="resume">
      {{ form.resume }}
      <div id="browse">
        <a>BROWSE</a>
      </div>
    </div>
  </div>

  <div class="message {% if form.message.errors %}form-error{% endif %}">
    <p>MESSAGE</p>
    {{ form.message }}

  </div>
  {{ form.captcha }}
  <button class="submit-button" type="submit">
                                            APPLY
                                        </button>
</form>

我已根据文档更新了表单和设置,因此我认为不是问题所在。据我所知,到目前为止,我认为它必须与成像库有关,但我不太确定。我安装了Pillow 4.1.1,如果有帮助我就在Mac上。

1 个答案:

答案 0 :(得分:0)

对于任何偶然发现这一点的人,我都明白了。我必须在产品网址上方列出验证码网址,因为它正在寻找错误位置的图片。