运行时出现以下错误:Python manage.py createsuperuser
Traceback (most recent call last):
File "/Users/project/env/lib/python3.7/site-packages/django/contrib/auth/password_validation.py", line 174, in __init__
with gzip.open(password_list_path, 'rt', encoding='utf-8') as f:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gzip.py", line 53, in open
binary_file = GzipFile(filename, gz_mode, compresslevel)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gzip.py", line 163, in __init__
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/Users/project/env/lib/python3.7/site-packages/django/contrib/auth/common-passwords.txt.gz'
答案 0 :(得分:0)
问题与django目录中的 $faker = Faker\Factory::create();
for($i=1; $i<=100; $i++){
$s = new User();
$s->name = $faker->name;
$s->email = $faker->email;
$s->comments = $faker->text;
$s->save();
}
文件有关。取回文件的最简单方法是在虚拟环境中重新安装 django。