One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
jemes032
3 years agoNew member | Level 2
Django, unable to locate static files when using Dropbox
I'm new to Django and I'm trying to understand the static and media files. I'm following to this practical example which uses AWS As I don't have AWS but Dropbox, I used django-storages but with Dropbox instead of AWS.
It works fine while storing the files locally. However, when pointing to Dropbox, I'm able to upload them but when loading the django app it fails as it does not find the icons.
Dropbox folder structure is as follows:
- Dropbox
- Aplicaciones
- ptstg
- bulma.min.css
- admin
- img
- icon1.jpg
- ...
- fonts
- ...
- css
- ...
- js
- ...
- img
- ptstg
- Aplicaciones
The value of my variables in SETTINGS are:
DROPBOX_ROOT_PATH = '/Aplicaciones/ptstg' DROPBOX_LOCATION = 'static' STATIC_FILES = 'staticfiles' STATIC_URL = f'{DROPBOX_LOCATION}/' STATICFILES_STORAGE = 'storages.backends.dropbox.DropBoxStorage' DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
I'm expecting to store and access the static and image files from the root folder /Aplicaciones/ptstg. And it does. However, it uploads all files into a folder called 'admin' with the icons inside img folder (same img folder name is used when locally, and it works).
When I try to reload my site, it fails and it complain: Exception Value:
ApiError('dea1242d617d4ef9a8b9afe5ab06fd97', GetTemporaryLinkError('path', LookupError('not_found', None)))
And it points to the following file: Error during template rendering in template /usr/src/app/upload/templates/upload.html, error at line 8
1 {% load static %} 2 3 <!DOCTYPE html> 4 <html> 5 <head> 6 <meta charset="utf-8"> 7 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 8 <link rel="shortcut icon" type="image/png" href="{% static 'images/favicon.png' %}
- Greg-DB
Dropbox Staff
A 'path/not_found' error like this indicates that there was nothing found in the connected account at the path specified for that API call. To troubleshoot this, I recommend you print out the full exact 'path' value that you're sending for that call. You'll need to make sure that value exactly matches the path in the account for the file you're trying to access. If you're uploading to one path and then trying to download that later, you'll need to make sure those paths match.
Also, note that if you're using an access token for an app with the "full Dropbox" access type, you should specific the full path, e.g., including '/Aplicaciones/ptstg' when applicable, but if you're using an access token for an app with the "app folder" access, you should omit the app folder path components "/Aplicaciones/ptstg', as API calls will operate from that root automatically.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 4 minutes ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!