创建超级用户时,出现这种报错
来源:8-1 通过django的admin快速搭建后台管理系统
慕侠3297407
2020-06-24
manage.py@untitled1 > createsuperuser
"C:\Program Files\JetBrains\PyCharm 2020.1\bin\runnerw64.exe" C:\Users\18660\Envs\mxonline\Scripts\python.exe “C:\Program Files\JetBrains\PyCharm 2020.1\plugins\python\helpers\pycharm\django_manage.py” createsuperuser C:/Users/18660/PycharmProjects/untitled1
Tracking file by folder pattern: migrations
Username: bobby
Email address: 1@1.com
Warning: Password input may be echoed.
Password: adminadmin
Warning: Password input may be echoed.
Password (again): adminadmin
Traceback (most recent call last):
File “C:\Program Files\JetBrains\PyCharm 2020.1\plugins\python\helpers\pycharm\django_manage.py”, line 52, in
run_command()
File “C:\Program Files\JetBrains\PyCharm 2020.1\plugins\python\helpers\pycharm\django_manage.py”, line 46, in run_command
run_module(manage_file, None, ‘main’, True)
File “c:\users\18660\appdata\local\programs\python\python37\lib\runpy.py”, line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File “c:\users\18660\appdata\local\programs\python\python37\lib\runpy.py”, line 96, in run_module_code
mod_name, mod_spec, pkg_name, script_name)
File “c:\users\18660\appdata\local\programs\python\python37\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File “C:/Users/18660/PycharmProjects/untitled1\manage.py”, line 21, in
main()
File “C:/Users/18660/PycharmProjects/untitled1\manage.py”, line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\18660\Envs\mxonline\lib\site-packages\django\core\management_init.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\18660\Envs\mxonline\lib\site-packages\django\core\management_init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\core\management\base.py”, line 323, in run_from_argv
self.execute(*args, **cmd_options)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py”, line 61, in execute
return super().execute(*args, **options)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\core\management\base.py”, line 364, in execute
output = self.handle(*args, **options)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py”, line 156, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\contrib\auth\models.py”, line 162, in create_superuser
return self._create_user(username, email, password, **extra_fields)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\contrib\auth\models.py”, line 145, in _create_user
user.save(using=self._db)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\contrib\auth\base_user.py”, line 66, in save
super().save(*args, **kwargs)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\base.py”, line 741, in save
force_update=force_update, update_fields=update_fields)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\base.py”, line 779, in save_base
force_update, using, update_fields,
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\base.py”, line 870, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\base.py”, line 908, in _do_insert
using=using, raw=raw)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\manager.py”, line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\query.py”, line 1186, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\sql\compiler.py”, line 1331, in execute_sql
for sql, params in self.as_sql():
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\sql\compiler.py”, line 1275, in as_sql
for obj in self.query.objs
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\sql\compiler.py”, line 1275, in
for obj in self.query.objs
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\sql\compiler.py”, line 1274, in
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\sql\compiler.py”, line 1225, in pre_save_val
return field.pre_save(obj, add=True)
File “C:\Users\18660\Envs\mxonline\lib\site-packages\django\db\models\fields\files.py”, line 286, in pre_save
if file and not file._committed:
AttributeError: ‘int’ object has no attribute ‘_committed’
Process finished with exit code 1
1回答
-
bobby
2020-06-24
https://stackoverflow.com/questions/50916553/int-object-has-no-attribute-committed-django
022020-06-27
相似问题
回答 2
回答 1