django: serve static assets *without* copying them (collect static)

django, python

Solution

Use

python manage.py collectstatic --link

From https://docs.djangoproject.com/en/1.7/ref/contrib/staticfiles/#django-admin-option---link:

-l

--link Create a symbolic link to each file instead of copying.

This way they won't use up extra space, if the Heroku systems allow symbolic links.

Problem

I'm hosting a django project on heroku, which limits the total app size to 300MB, and I have a lot of static assets to be served. because of django "collectstatic" which copies all the static assets to another directory, I exceed that limit. now I know the right way to do it is to serve the static assets from an external file storage service (like amazon S3 bucket), but I have my reasons why I don't want to use an external storage service and that's out of the question. so I'm asking this: how can I use django to serve static assets directly from their original folders WITHOUT copying them to another destination? thanks!

Original source