Add a picture to the admin panel. Add a picture to the admin panel. I click "Save and continue editing" the picture disappears. I click "Save and continue editing" the picture disappears

How to fix?

settings.py

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

URLS

from django.conf.urls.static import static from django.conf import settings urlpatterns = [.... ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

DB - sqlite3 enter image description here

  • Folder for pictures created? - Mr. Fix
  • img = models. ImageField ('screenshot', upload_to = 'blog / images', default = '', blank = True) - Dev KD
  • I mean the folder images, in the way that you set up, created on the computer? - Mr. Fix
  • yes added. blog / images - Dev KD
  • one
    Well, if the folder exists, then everything should work. You have default = "" in the settings of the field, ie the empty string by default, most likely it is saved. I can only offer to remove the default, and on exceptions otdebazhit handles. - Mr. Fix

0