I deployed my project to web faction, set the static and media settings. Initially media files not showing, only the static files are shown in the site. But I can see the media files in my local system.
I used filefield not imagefield during model creation. Is that a problem? is tried both ways:
<img src="{{MEDIA_URL}}{{i.cover_image.url}}" alt="">
<img src="{{i.cover_image.url}}" alt="">
These are settings:
settings.py
STATIC_URL = '/static/'
STATIC_ROOT = '/home/{}/webapps/testapp_static/'.format('user')
STATIC_FILE_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL= '/media/'
And i added this setting to myproject urls urls.py
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Please help me where i went wrong. Is there any additional settings or path is missing. i want to view media files in my template.