django code captcha

Official documents  https://django-simple-captcha.readthedocs.io/en/latest/usage.html#installation

Use the command to install pip install django-simple-captcha == 0.4.6 (== followed by the version number)

Add to settings.py installed after the

 The  URL ( R & lt 'captcha ^ /' , the include ( 'captcha.urls' )), urls.py added to the project, as shown below

 Run python manage.py migrate 如下图

Excuting an order

makemigrations 
then perform
migrate

Data migration table

 There is no description given to the captcha component codes and can be successfully installed the following steps:

In users of forms.py in RegisterForm Class added to the inside, as shown :( remember at captcha.fields import CaptcahField from)

 

 Execution code shown below in the views of users in a red box:

 

 

 

 Finally, write the following code in the file register.py

 

 

 The final image as shown below:

 

 

Guess you like

Origin www.cnblogs.com/zmdComeOn/p/11258654.html