Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 可疑操作:尝试访问路径默认\存储django_Python_Django_Mod Python_Django Storage_Django Errors - Fatal编程技术网

Python 可疑操作:尝试访问路径默认\存储django

Python 可疑操作:尝试访问路径默认\存储django,python,django,mod-python,django-storage,django-errors,Python,Django,Mod Python,Django Storage,Django Errors,我正在尝试将PDF保存到我的项目中的文件夹中文件夹具有读取、写入权限当我尝试保存PDF时,我收到以下错误: 可疑操作:试图访问/opt/django_应用程序/inscripcion/claudes/filename 这是我的简单代码: contenido = "Simple code" file_name = "/opt/django_apps/inscripcion/solicitudes/filename" path = default_storage.save(file_name,

我正在尝试将
PDF
保存到我的
项目中的文件夹中
文件夹具有读取、写入权限
当我尝试保存
PDF
时,我收到以下错误:

可疑操作:试图访问/opt/django_应用程序/inscripcion/claudes/filename

这是我的简单代码:

 contenido = "Simple code"
 file_name = "/opt/django_apps/inscripcion/solicitudes/filename"
 path = default_storage.save(file_name, ContentFile(contenido))

我在
RedHat
上将
python2.7
mod_python
django1.3
一起使用

raise ValueError('The joined path (%s) is located outside of the base '
                 'path component (%s)' % (final_path, base_path))
默认存储的
基本路径
设置。媒体根

我建议用

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

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

现在我将尝试使用
内置的
打开
功能:驻留,最简单的决定胜过一切:)