django使用captcha报错:No module named 'captcha'
在django虚拟环境安装了captcha
pip install django-simple-captcha
在settings.py里进行了注册:
在urls.py里也增加了对应网址:
在models.py里导入和在表单中使用都未报错:
class UserForm(forms.Form):
username = forms.CharField(label="用户名", max_length=32, widget=forms.TextInput(attrs={'class': 'form-control'}))
password = forms.CharField(label="密码", max_length=64, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
captcha = CaptchaField(label='验证码')
在html文件中添加验证:
做完这些进行运行时,代码报错:
ModuleNotFoundError: No module named ‘captcha’
推荐文章: