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))
现在我将尝试使用内置的
打开
功能:驻留,最简单的决定胜过一切:)