2018-7-18 日 源码阅读

1 、migrate的字段值可以在相应的文件夹/ migrations /0001_intial.py 内修改,比如修改字段长度,default

2、用python manage.py shell 来启动 django 的加密方法,在setting中设置如下

PASSWORD_HASHERS = (
   'django.contrib.auth.hashers.PBKDF2PasswordHasher',
    'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
    'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
    'django.contrib.auth.hashers.BCryptPasswordHasher',
    'django.contrib.auth.hashers.SHA1PasswordHasher',
    'django.contrib.auth.hashers.MD5PasswordHasher',
    'django.contrib.auth.hashers.CryptPasswordHasher',
)
通过此方法,生成加密密码,添加到mysql中,生成新的超级用户,因为我使用createsuperuser创建用户报错。可能与数据库是是拷贝过来的有关系。
原文地址:https://www.cnblogs.com/kkkboshow/p/9328906.html