1
I am using the following API:
https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
I have exactly everything configured, from the lib installed to the settings of Settings.py.
A lib 'storages' in INSTALLED_APPS and the three variables of connection with Dropbox:
DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
DROPBOX_OAUTH2_TOKEN = 'meu_token'
DROPBOX_ROOT_PATH = '/media/'
I want the Filefield and Imagefield fields to upload an image or file and save it in the project’s/media/ folder and the Dropbox, keeping the image in production, having the App created and configured to be app_folder.
If I remove the three configuration variables from Dropbox and try to modify or add an image by Django admin is possible, but when I return the variables and try again, the following error appears:
ValidationError at /admin/catalog/product/6/change/
'C:/media/products/cortina-city.jpg' did not match pattern '(/(.|[\r\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)'
Gives error also in lib Dropbox.py:
C:\Users\evert\Desktop\Synth\SynthDev\myenv\lib\site-packages\storages\backends\dropbox.py in exists
return bool(self.client.files_get_metadata(self._full_path(name))) ...
C:\Users\evert\Desktop\Synth\SynthDev\myenv\lib\site-packages\dropbox\base.py in files_get_metadata
include_property_groups) ...
C:\Users\evert\Desktop\Synth\SynthDev\myenv\lib\site-packages\dropbox\files.py in __init__
self.path = path ...
C:\Users\evert\Desktop\Synth\SynthDev\myenv\lib\site-packages\dropbox\files.py in path
val = self._path_validator.validate(val) ...
C:\Users\evert\Desktop\Synth\SynthDev\myenv\lib\site-packages\dropbox\stone_validators.py in validate
% (val, self.pattern))
I understand that you are not identifying the url get pattern. I imagine that C: should not go together in the string and is going, i.e., 'C:/media/products/..".
How to solve this?
Everton , like this your file urls.py ?
– Otávio Reis Perkles
I have the configuration: if Settings.DEBUG: urlpatterns += Static(Settings.MEDIA_URL, document_root=Settings.MEDIA_ROT)
– Everton Alauk