Django创建超级用户时,出现错误 ValueError: invalid literal for int() with base 10: ''

ERROR exception 135 Internal Server Error: /users/
Traceback (most recent call last):
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/core/handlers/base.py", line 187, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, callback_args, **callback_kwargs)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/generics.py", line 242, in post
return self.create(request, *args, **kwargs)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/mixins.py", line 19, in create
self.perform_create(serializer)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/mixins.py", line 24, in perform_create
serializer.save()
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/rest_framework/serializers.py", line 213, in save
self.instance = self.create(validated_data)
File "/home/python/dihai02/per02/apps/users/serializers/user.py", line 25, in create
user = User.objects.create_user(
*validated_data)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/contrib/auth/models.py", line 159, in create_user
return self._create_user(username, email, password, **extra_fields)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/contrib/auth/models.py", line 153, in _create_user
user.save(using=self._db)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 80, in save
super(AbstractBaseUser, self).save(*args, **kwargs)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 808, in save
force_update=force_update, update_fields=update_fields)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 838, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 924, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/base.py", line 963, in _do_insert
using=using, raw=raw)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/query.py", line 1076, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1111, in execute_sql
for sql, params in self.as_sql():
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1064, in as_sql
for obj in self.query.objs
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1064, in
for obj in self.query.objs
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1063, in
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1003, in prepare_value
value = field.get_db_prep_save(value, connection=self.connection)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/fields/
_init__.py", line 770, in get_db_prep_save
prepared=False)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 762, in get_db_prep_value
value = self.get_prep_value(value)
File "/home/python/.virtualenvs/yuan/lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 1853, in get_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: ''

qq_42559972
彼岸花正茂 环境是 python3.7+django1.11.11
大约 2 个月之前 回复

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

2
django中创建表python manage.py makemigrations出现以下错误 ,望大神指导
0
django 超级用户(superuser)进入admin没有权限
2
Django实现Web应用显示单个主题时出现错误: 'function' object has no attribute 'entry_set'
1
django创建项目时,urls.py报错:No module named 'index.urls'
2
django启动服务时报错 UnicodeDecodeError: 'utf8' codec can't decode byte 0xcb
1
Pycharm创建Django项目时配置虚拟环境报错
0
django、subprocess多进程 报错django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
0
从Github导入Django项目运行时报如下错误:
2
Django报错:django.server:"GET /favicon.ico HTTP/1.1" 500 59,该如何解决?
1
django连接MySQL报错django.db.utils.OperationalError: (2006, <NULL>)?
1
Django升级后出现了ModuleNotFoundError: No module named 'Studentdjango' 请求大神帮忙看一下
1
<python从入门到实践>18章Django联系创建模型Pizzas和Topping时运行migrate时出现错误django.db.utils.OperationalError: no such table: pizzas_pizza
0
Pycharm 创建Django出现的问题
1
关于Django运行编码问题
1
[django]创建用户注册时密码不隐藏
1
django.db.utils.InternalError: (1050, "Table 'django_content_type' already exists") 迁移文件建立数据表的时候一直报错
2
django 动态创建数据库连接
1
[django。html]我在gitkraken上传django文件时上传不了css文件
0
Django新建应用url测试500错误
1
django.db.utils.OperationalError: disk I/O error