[Answered ]-SuspiciousOperation :Attempted access to path default_storage django

2👍

The actual exception is raised in django/utils/_os.py on line 76:

raise ValueError('The joined path (%s) is located outside of the base '
                 'path component (%s)' % (final_path, base_path))

And base_path for default_storage is settings.MEDIA_ROOT.

I’d suggest creating FileSystemStorage with

file_storage = FileSystemStorage(location = '/opt/django_apps/inscripcion/solicitudes/')

And then

contenido = "Simple code"
file_name = "filename"
path = file_storage.save(file_name, ContentFile(contenido))
👤twil

Leave a comment