I am implementing a blog app in django using zinnia. Blog is perfectly running in local server , but when deployed in heroku, images are not being uploaded.
My settings file is like this,
DEBUG = False
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, '..', 'static'),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media')
ZINNIA_UPLOAD_TO = 'media/uploads/zinnia'
Storing static/media files on Heroku's servers is problematic and discouraged. There are workarounds but it's easier to use an alternative to host these. Plus, when a dyno is respun the files on Heroku will be erased.
The most used solution is to use a web service to store your files. In my own attempts to collect static and media files directly on Heroku's servers (including with Zinnia) images would appear as broken/missing links. Since Zinnia's image files are collected via collectstatic (which runs each time you push to Heroku), this is expected behavior.
For both ease of use and performance you should serve staticfiles from another source such as AWS S3, as detailed here-https://devcenter.heroku.com/articles/s3
Please note: The Whitenoise library is a wonderful way to serve static/media assets directly out of Heroku. It's fast, easy to set up, and very stable. When you expect to have a huge store of files, it might not be the best, but for a relatively small site it is peas and carrots.
See also- Serve static files on heroku using AWS S3 for django? http://agiliq.com/blog/2014/06/heroku-django-s3-for-serving-media-files/