带有Dropbox的django-storages的路径错误 [英] Error in path with django-storages with dropbox

查看:77
本文介绍了带有Dropbox的django-storages的路径错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的设置代码

DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
DROPBOX_OAUTH2_TOKEN = "my token"
DROPBOX_ROOT_PATH = "Apps/Djangoproject"

我在上传图片时遇到的错误:

The error i am getting while uploading a image:

ValidationError: did not match pattern '(/(.|[\r\n])|id:.)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)'
how to solve this issue?

有人知道如何解决这个问题吗?

Anyone know how to solve this issue?

推荐答案

您正在提供"Apps/Djangoproject" 的路径,并且该错误表明该路径与预期路径不匹配格式,如提供的regex模式所示.具体来说,在这种情况下是因为非根Dropbox路径应以"/" 开头,而您的不是.

You're supplying a path of "Apps/Djangoproject", and the error is indicating that it does not match the expected path format, as shown by the supplied regex pattern. Specifically, in this case it's because non-root Dropbox paths should start with a "/", but yours doesn't.

因此,如果您的应用程序具有完整的Dropbox 访问权限,并且您要访问该"Djangoproject"文件夹,您的路径值应为:"/Apps/Djangoproject" .但是,如果您有一个具有应用程序文件夹访问权限的应用程序,并且"Djangoproject"是您的应用程序文件夹,则实际上应该只提供根路径值:" .(即,一个空字符串.对于具有应用文件夹权限的应用,Dropbox会自动将根解释为应用文件夹.)

So, if you have an app with full Dropbox access and you want to access that "Djangoproject" folder, your path value should be: "/Apps/Djangoproject". However, if you have an app with app folder access and that "Djangoproject" is your app folder, you should actually just supply the root path value: "". (That is, an empty string. Dropbox automatically interprets the root as the app folder for apps with the app folder permission.)

这篇关于带有Dropbox的django-storages的路径错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆