Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku django project read-only file system

I'm deploying django project on heroku, it works fine, but in django admin, when i'm trying to upload image i got error:

OSError at /admin/blocks/block/add/

[Errno 30] Read-only file system: '/home/goldwedd'
like image 293
Arti Avatar asked Jul 18 '13 06:07

Arti


People also ask

How do I serve a static file in Heroku?

Try using Amazon s3 for storing static and media files. A similar question and answer can be found here. Here is heroku's documentation of using s3. Then you might want to disable automatic collectstatic instructions here so collectstatic isn't run every time you push to heroku.

What is a Procfile in Django?

The basics. First, and most importantly, Heroku web applications require a Procfile . This file is used to explicitly declare your application's process types and entry points. It is located in the root of your repository. Procfile web: gunicorn myproject.wsgi.


1 Answers

This is by design.

Your app is compiled into a slug for fast distribution by the dyno manager. The filesystem for the slug is read-only, which means you cannot dynamically write to the filesystem for semi-permanent storage. The following types of behaviors are not supported:

  • Caching pages in the public directory
  • Saving uploaded assets to local disk (e.g. with attachment_fu or paperclip)
  • Writing full-text indexes with Ferret
  • Writing to a filesystem database like SQLite or GDBM
  • Accessing a git repo for an app like git-wiki

https://devcenter.heroku.com/articles/read-only-filesystem

If you want to upload files, you need to do so to S3 or any of the other storage backends supported by django-storages.

like image 155
Thomas Avatar answered Sep 17 '22 17:09

Thomas