【发布时间】:2021-05-23 13:34:54
【问题描述】:
你好,我一直是这个问题,因为我在它为空时将 sqlite 更改为 postgresql 我点击迁移并创建表,当我创建超级用户时它会出错但仍然创建管理员用户,并且当它创建时我无法登录所以它的基本 django 管理员并且不应该有所不同我该如何解决这个问题?是迁移错误还是?
这是我创建超级用户时的回溯
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
return super().execute(*args, **options)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 189, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/contrib/auth/models.py", line 157, in create_superuser
return self._create_user(username, email, password, **extra_fields)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/contrib/auth/models.py", line 140, in _create_user
user.save(using=self._db)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 67, in save
super().save(*args, **kwargs)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/db/models/base.py", line 753, in save
self.save_base(using=using, force_insert=force_insert,
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/db/models/base.py", line 801, in save_base
post_save.send(
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 177, in send
return [
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 178, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/var/www/html/web/users/signals.py", line 11, in create_profile
Profile.objects.create(user=instance)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/db/models/query.py", line 447, in create
obj.save(force_insert=True, using=self.db)
File "/var/www/html/web/users/models.py", line 25, in save
img = Image.open(self.image.path)
File "/var/www/html/web/venv/lib/python3.8/site-packages/django/db/models/fields/files.py", line 57, in path
return self.storage.path(self.name)
File "/var/www/html/webst/venv/lib/python3.8/site-packages/django/core/files/storage.py", line 116, in path
raise NotImplementedError("This backend doesn't support absolute paths.")
NotImplementedError: This backend doesn't support absolute paths.
【问题讨论】:
标签: python python-3.x django postgresql django-rest-framework