Static assets receives 403 on digital ocean.

147 views
Skip to first unread message

ASAMOAH EMMANUEL

unread,
Jan 3, 2024, 10:03:07 PMJan 3
to django...@googlegroups.com
Hi, please help. I have been trying to deploy my App to digital ocean but after deploying, my static assets do not show. I have set file and directory permissions but still in vain. this is what outputs when inspecting the browser console. help would be highly appreciated: Error
logo.png:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden)
6
Unchecked runtime.lastError: The message port closed before a response was received.
Error
styles.css:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden)
Error
index.css:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden)
Error
main.js:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden)
Error
reload-listener.js:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden)
Error
/static/sound/click.wav:1 Request unavailable in the network panel, try reloading the inspected pageRequest unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 403 (Forbidden)

Ryan Nowakowski

unread,
Jan 6, 2024, 12:08:15 PMJan 6
to django...@googlegroups.com
When you try to load one of the static assets in a separate browser tab, what content is rendered? Sometimes that gives you a hint as to why access is denied(403).

Ruby

unread,
Jan 6, 2024, 1:30:11 PMJan 6
to django...@googlegroups.com
This could be some permission-related issue, consider adding the web app user to the www-data group by running the command below

 sudo usermod -a -G "$USER" www-data

Remember to restart the web server after executing the above command.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/E67EA63B-4611-4323-88E7-98A013BC793D%40fattuba.com.

ASAMOAH EMMANUEL

unread,
Jan 7, 2024, 7:13:19 AMJan 7
to django...@googlegroups.com
sudo usermod -aG simple_genius www-data
sudo chown -R :www-data /home/simple_genius/projects/personal and it worked.


Now the problem is when I set DEBUG to False, some of my static assets does not serve. I am using whitenoise to serve static assets. I am also using django-tailwind in my project. STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"



This is what is shown on the console when I inspect:
"Error
/static/css/index.5398d9d5876f.css:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
/static/css/dist/sty….7012601486cf.css:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
logo.a5ccc3546241.png:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
main.b84581c0c996.js:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
/static/sound/click.4db7b7b75cbd.wav:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
/static/sound/tick.052246d34aa1.wav:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
/static/sound/swish.af479ba9668b.m4a:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
banner.9b9fbdecaf08.png:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
index.5398d9d5876f.css:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)
Error
styles.7012601486cf.css:1 Request unavailable in the network panel, try reloading the inspected page Failed to load resource: the server responded with a status of 404 (Not Found)"

ram.mu...@gmail.com

unread,
Mar 4, 2024, 8:10:07 PMMar 4
to Django users
Reply all
Reply to author
Forward
0 new messages