2

I have an issue about http://code.google.com/p/django-simple-captcha/ project. I've follow the procedure to install captcha, the form works but the browser don't load the image. What to do?

My patterns:

from django.conf.urls.defaults import patterns, include, url
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', 'main.views.main', name="main_page"),
    url(r'^registration$', 'main.views.registration', name="registration"),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    # Captcha
    url(r'^captcha/', include('captcha.urls')),
)

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^files/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
    )
Jazi
  • 6,569
  • 13
  • 60
  • 92

3 Answers3

6

Make sure you have all the dependencies for the Captcha app: cd into your project directory, then run:

./manage.py test captcha

See if it reports any errors.

Also, make sure you've completed the four steps in the installation instructions: http://code.google.com/p/django-simple-captcha/#Installation

Marco
  • 1,196
  • 9
  • 11
  • 1
    I run that test command and it detected one error: `ImportError: The _imagingft C module is not installed`. I've installed PIL from here [link](http://www.lfd.uci.edu/~gohlke/pythonlibs/) and it's working :). Thanks! – Jazi Aug 27 '11 at 14:09
  • Thanks, it helped! I also had problems with _imagingfg module but [this thread](http://stackoverflow.com/questions/4011705/python-the-imagingft-c-module-is-not-installed) helped me. – Piotr Sobczyk Nov 01 '11 at 12:31
0

it's not very much info to go by, but here we go. if you have google chrome you can do ctrl-shift-i to open the browser inspector. go to the resources tab, it should have an error about an image resource. check which url it tries to load and see why there isn't an image at that url.

doxin
  • 698
  • 1
  • 7
  • 22
-1

in windows operating System

  1. pip install captcha

  2. edit setting.py in installed app to mention 'captcha'

  3. after that add URL to urls.py,

    url(r'^captcha/', include('captcha.urls'))
    
  4. forms.py write

    from captcha.fields import CaptchaField
    
    captcha = CaptchaField()
    
  5. Submit and change the captcha .html file

     <button class='js-captcha-refresh'>Refresh Captcha</button><br><br>
     <input type="submit" class="btn btn-default" value="Submit" />
    
Artjom B.
  • 61,146
  • 24
  • 125
  • 222