سؤال

I am trying to allow users to upload files for a django app running on heroku and am running into some issues. In my development environment (using the django development server), I have it set up to allow users to upload files (a small image/logo). Everything is working great.

When I try to run it on heroku or even on my development server using gunicorn (instead of the django development server), users are unable to upload files. I know generally it is best to use something like Amazon S3, however since the files are relatively small I thought starting directly on heroku might work.

I understand that I can get uploaded files to work with manage.py collectstatic, however this isn't the issue as the uploaded file never actually gets uploaded. I do not notice any errors that I can see.

Is what I am trying to accomplish practical? Should I be focusing on trying to get this to work with S3 instead? It seems a little daunting for my needs now but I am open to suggestions or help of any kind.

Thanks,

Edit: It appears that it only works outside my virtual environment. It doesn't matter if gunicorn is being used or not inside the virtual environment.

هل كانت مفيدة؟

المحلول

I think you should be focusing on something like S3 as an external store to assets created during your program execution yes. Heroku uses an ephemeral filesystem for each dyno, so that certainly won't be the place to upload the files, even if they are small.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top