xRo*_*bot 2 django django-models django-admin
我在settings.py中插入了这个:
AUTHENTICATION_BACKENDS = (
    'blog.auth.backends.EmailBackend',
    'django.contrib.auth.backends.ModelBackend',
)
blog是一个应用程序(正确安装),auth是博客应用程序中的文件夹,backends.py是包含此方法的文件:
from django.contrib.auth.backends import ModelBackend
from django.core.validators import email_re
from django.contrib.auth.models import User
class EmailBackend(ModelBackend):
    def authenticate(self, username=None, password=None):
        if email_re.search(username):
            try:
                user = User.objects.get(email=username)
                if user.check_password(password):
                    return user
            except User.DoesNotExist:
                return None
        return None
我的问题是:
为什么我会收到此错误?:
ImproperlyConfigured at /signup/
Error importing authentication backend auth.backends: "No module named auth.backends" 
| 归档时间: | 
 | 
| 查看次数: | 1223 次 | 
| 最近记录: |