python 验证码库 captcha的使用以及遇到的问题解决
来源:互联网 发布:php网站开发实例教程 编辑:程序博客网 时间:2024/05/20 05:29
先附上库的GitHub地址:https://github.com/mbi/django-simple-captcha
看下帮助文档,如果把这个库应用到我们的项目中
1.Download django-simple-captcha using pip by running: pip install django-simple-captcha 首先pip安装这个库
2.. Add captcha to the INSTALLEDAPPS in your settings.py 然后在settings.py-->INSTALLEDAPPS
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'operation', 'courses', 'users', 'organization', 'xadmin', 'crispy_forms', 'captcha' ]
3..Run python manage.py syncdb (or python manage.py migrate if you are managing database migrations via South) to create the required database tables
执行makemigrations 命令 以及 migrate,生成对应的数据库文件,可以查看下数据库
4.Add an entry to your urls.py:配置url
urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url('^$', TemplateView.as_view(template_name='index.html'), name="index"), url('^login/$', LoginView.as_view(), name="login"), url('^register/$', RegisterView.as_view(), name="register"), url(r'^captcha/', include('captcha.urls')),]
这样我们准备工作就做好了,注册用到了这个验证码问题,具体的怎么实现的显示可以移步到登录注册看,
当我们把所有代码逻辑写出执行,发现并没有出现预想的结果。而是。。。。。
然后一脸懵逼的 F12看了下竟然 。。。。
然后我就各种问啊,请教啊,结果还是好的,
windows系统,使用PIL库的ImageFont.truetype()方法时,报错:
The _imagingft C module is not installed
说明自己电脑里安装的PIL库缺少一个freetype的库文件,我也手动安装了这个库,出现了_imagingft.pyd,但是import _imagingft时报错说DLL无法加载。
现在已解决了这个问题,解决方法:
1、卸载原来版本的PIL
pip uninstall pil
2、重新安装一个已经包含freetype库的PIL安装包,可以从该地址下载,并安装。
http://download.csdn.net/detail/ivy94419/9465338
- python 验证码库 captcha的使用以及遇到的问题解决
- Yii 验证码(captcha)的使用
- 关于Captcha验证码组件的使用
- Yii框架captcha验证码的使用
- Laravel的验证码库gregwar/captcha
- Laravel的验证码库gregwar/captcha
- Laravel的验证码库gregwar/captcha
- Laravel的验证码库gregwar/captcha
- Laravel的验证码库gregwar/captcha
- Cakephp中使用Captcha实现更加安全的验证码
- CI框架验证码CAPTCHA 辅助函数的使用
- Django 验证码的使用 -django-simple-captcha使用方法
- Yii2.x 中captcha 验证码使用的一些心得
- CAPTCHA(验证码)的来源与作用
- Python下的Captcha
- Yii2学习笔记(六):验证器captcha的使用
- yii验证码Captcha使用以及为什么验证码不刷新问题
- A Variety of Captcha 各式各样的验证码
- vue 重温一下vue运行生命周期,与分子组件事件分发
- malloc函数详解
- 洛谷P2814 家谱
- 欢迎使用CSDN-markdown编辑器
- 【LeetCode】561. Array Partition I
- python 验证码库 captcha的使用以及遇到的问题解决
- 线性回归与梯度下降(gradient descent)算法
- English words page one
- 畅通工程续
- 欢迎使用CSDN-markdown编辑器
- poj 3687 Labeling Balls【反向拓扑】
- 记一次Fedora 25下手动安装Eclipse Oxygen的步骤
- Tree-----最低公共祖先系列
- 单链表实现文件版本通讯录