I need help from someone who understands linux. I can't push my staticfiles to Heroku (I'm trying to use whitenoise and not Amazon S3 or any CDN). The error is rather simple, when I try to push to heroku I get:
Preparing static assets
Running collectstatic...
Traceback (most recent call last):
OSError: [Errno 30] Read-only file system: '/assets'
So, I can't run collectstatic cause I don't have permissions. If I do sudo git push heroku master
I get another error: Permission denied (publickey)
And I guess that is cause 'sudo' uses a different SSH key.
I've tried to change permissions to the folder from the file manager and I've also tried from bash:
sudo chmod 777 -R static
static is the parent folder: static/assets.
So... how can I solve this? Any help will be greatly appreciated.
I don't think the problem is pushing content to Heroku, specifically. You're trying to save assets to a root folder on the virtual machine, which your'e not allowed to do.
Traditionally with Heroku, you'd set the static assets directory to something like staticfiles
(not /staticfiles
or /assets
). When Heroku deploys the app to its virtual machines (what it calls "dynos") it works in its own little directory (I think it's /app
), so all the directories you specify in your settings.py file are relative to that directory.
Try setting the static files root directory to staticfiles
or assets
without the slash, and that should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With