0

My django application shows internal server error when I try to upload images in the production server when I turn the debug = False and it works well when debug = True. I'm using django-imagekit for processing the images. I'm using Whitenoise to server my media and static files.

Here is my code:
setting.py

STATIC_URL = '/static/'

MEDIA_URL = 'media/'

MEDIA_ROOT =  'media/'

STATIC_ROOT = 'staticfiles/'

STATICFILES_DIRS = [
   os.path.join(BASE_DIR, 'static')
]
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

urls.py

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

models.py

 image = ProcessedImageField(upload_to='authors', format='JPEG', options={'quality': 60})

I hosted the site on Vercel

Dhiman
  • 103
  • 1
  • 8

0 Answers0