Error in path with django-storages with dropbox

蹲街弑〆低调 提交于 2021-01-29 11:41:47

问题


This is my settings code

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?


回答1:


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.

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.)



来源:https://stackoverflow.com/questions/59801365/error-in-path-with-django-storages-with-dropbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!