django image field 'current' remove site:stackoverflow.com
# models.py
from django.db import models
class YourModel(models.Model):
current = models.ImageField(upload_to='your_upload_path/')
# settings.py
# Add or modify the MEDIA_URL and MEDIA_ROOT settings
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / "media"
# urls.py
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# Your existing URL patterns go here
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)