У меня есть простое приложение Django, развернутое в App Engine, которое подключается к экземпляру Cloud SQL (PostgreSQL). Это Django приложение позволяет пользователям входить / регистрироваться и выставлять товары на продажу. Вход / регистрация работает нормально, но при выставлении товаров на продажу я получаю следующую ошибку:
Request Method: POST
Django Version: 3.0.3
Python Version: 3.7.7
Installed Applications:
['projects',
'blog',
'users.apps.UsersConfig',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['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 "/env/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/env/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/srv/projects/views.py", line 28, in createListing
link.save()
File "/srv/projects/models.py", line 24, in save
super(Listing_Database, self).save(*args, **kwargs)
File "/env/lib/python3.7/site-packages/django/db/models/base.py", line 746, in save
force_update=force_update, update_fields=update_fields)
File "/env/lib/python3.7/site-packages/django/db/models/base.py", line 784, in save_base
force_update, using, update_fields,
File "/env/lib/python3.7/site-packages/django/db/models/base.py", line 887, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "/env/lib/python3.7/site-packages/django/db/models/base.py", line 926, in _do_insert
using=using, raw=raw,
File "/env/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/env/lib/python3.7/site-packages/django/db/models/query.py", line 1204, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1383, in execute_sql
for sql, params in self.as_sql():
File "/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1328, in as_sql
for obj in self.query.objs
File "/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1328, in <listcomp>
for obj in self.query.objs
File "/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1327, in <listcomp>
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1278, in pre_save_val
return field.pre_save(obj, add=True)
File "/env/lib/python3.7/site-packages/django/db/models/fields/files.py", line 288, in pre_save
file.save(file.name, file.file, save=False)
File "/env/lib/python3.7/site-packages/django/db/models/fields/files.py", line 87, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File "/env/lib/python3.7/site-packages/django/core/files/storage.py", line 52, in save
return self._save(name, content)
File "/env/lib/python3.7/site-packages/django/core/files/storage.py", line 267, in _save
fd = os.open(full_path, self.OS_OPEN_FLAGS, 0o666)
Exception Type: OSError at /projects/createListing
Exception Value: [Errno 30] Read-only file system: '/srv/media/house_preview/question_4.PNG'
Я почти уверен, что это как-то связано с загрузкой изображений.