Django 1.9.5 filebrowser 3.7.2 image not showing and in template image url is wrong

336 Views Asked by At

filebrowser 127.0.0.1:8000/admin/filebrowser/browse/? upload file success

upload file image

image url href: href="media/uploads/chrysanthemum.jpg" but the url is wrong.

"/media/uploads/chrysanthemum.jpg"

this url is right.

"_versions/chrysanthemum_admin_thumbnail.jpg">

is wrong

"/media/_versions/chrysanthemum_admin_thumbnail.jpg">

is right. settings.py:

INSTALLED_APPS = [
    'grappelli',
    'filebrowser',
    'django.contrib.admin',
  ]
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = (
    ("images",os.path.join(STATIC_ROOT, 'images').replace('\\', '/')),
    ("css",   os.path.join(STATIC_ROOT, 'css').replace('\\', '/')),
    ("js",    os.path.join(STATIC_ROOT, 'js').replace('\\', '/')),
)
ADMIN_MEDIA_PREFIX = STATIC_URL + "grappelli/"
site.directory = "media/uploads/"
site.storage.location = BASE_DIR
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\','/')

directory: directory

1

There are 1 best solutions below

0
Redbridge On

settings.py remove two rows

site.directory = "media/uploads/"
site.storage.location = BASE_DIR

Because MEDIA_URL and MEDIA_ROOT were setted up. And Filebrowser is right