问题
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