When I upload the project to heroku, and change DEBUG=True to DEBUG=False, the images stop showing
That's my static and media root
STATIC_ROOT = Path(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
MEDIA_ROOT = Path(BASE_DIR, 'media')
MEDIA_URL = '/media/'
Essentially, by changing debug to false, you've put django into 'production' mode, which changes what is necessary for static files to be found. This is done because the 'dev' method is not proven secure.
For what to do in horoku, the horoku documentation has you covered:
For more information, the django docs talk about the process as well
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.