1

I was deployng my project to Heroku and set up the DEBUG option to False. Until that, all was working ok. But, now, I can't server the user profile images. I want to server only with the Django, not with Apache or Nginx. I know that it's not the best option, but I don't need the best way to do this, so, if exists any way to server this with only the Django, will better to me.

This is my settings.py:

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'saga', 'media')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

This is my urls.py:

from django.conf import settings
urlpatterns = [
    #URLs
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

And I think that's goodn say that I'm using the WhiteNoise to server the Static Files on Heroku.

Joao Lucas
  • 85
  • 1
  • 11
  • you can run your server in mode `--insecure`, maybe duplicated of https://stackoverflow.com/questions/9047054/heroku-handling-static-files-in-django-app – Mauricio Cortazar Mar 03 '18 at 03:06
  • How can I execute this command at Heroku? The post shows how to server the static files and I'm already serving them. The problem is with the user's uploads, because they don't work when I set `DEBUG = False`. – Joao Lucas Mar 05 '18 at 19:19

0 Answers0