Environment:
Request Method: POST
Request URL: http://0.0.0.0:8001/admin/mysite/shoe/add/
Django Version: 5.0.4
Python Version: 3.12.3
Installed Applications:
['corsheaders',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'mysite']
Installed Middleware:
['corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 299, in _commit
return self.connection.commit()
^^^^^^^^^^^^^^^^^^^^^^^^
The above exception (FOREIGN KEY constraint failed) was the direct cause of the following exception:
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/contrib/admin/options.py", line 716, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/utils/decorators.py", line 188, in _view_wrapper
result = _process_exception(request, e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/utils/decorators.py", line 186, in _view_wrapper
response = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/views/decorators/cache.py", line 80, in _view_wrapper
response = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/contrib/admin/sites.py", line 240, in inner
return view(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/contrib/admin/options.py", line 1945, in add_view
return self.changeform_view(request, None, form_url, extra_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/utils/decorators.py", line 48, in _wrapper
return bound_method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/utils/decorators.py", line 188, in _view_wrapper
result = _process_exception(request, e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/utils/decorators.py", line 186, in _view_wrapper
response = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/contrib/admin/options.py", line 1803, in changeform_view
with transaction.atomic(using=router.db_for_write(self.model)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/db/transaction.py", line 263, in __exit__
connection.commit()
^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 323, in commit
self._commit()
^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 298, in _commit
with debug_transaction(self, "COMMIT"), self.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/mysite/SneakerSite/backend/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 299, in _commit
return self.connection.commit()
^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: IntegrityError at /admin/mysite/shoe/add/
Exception Value: FOREIGN KEY constraint failed
my github: GitHub - TNGS0506/SneakerSite