Z
Z
zelsky2015-10-27 13:18:59
Django
zelsky, 2015-10-27 13:18:59

Images not working on django production - how to fix?

When I turn on debug true - everything works fine, but that's when it's false. Django can't find images.
I changed the permissions on the folder with the media to 755 then to 777, because in the admin panel it was impossible to add an image to the server because there were not enough rights.
upd. Now 1 out of 3 is working. But why ? urls are the same everywhere.

STATIC_URL = '/static/'
DEBUG = True

ALLOWED_HOSTS = []

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media')

CKEDITOR_UPLOAD_PATH = "media/"
CKEDITOR_IMAGE_BACKEND = "pillow"
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
un1t, 2015-10-27
@zelsky

Static and media should be distributed by a web server, not janga.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question