[Answer]-Django image upload is not working

1👍

Try this : storeImage = models.ImageField(upload_to="images")

This will append your file name ex: abc.png to images/abc.png and then set media dir where you want to store images for ex: yourAppDIR/static/images/....

And set the URL :

url(r'^tosomeThing/(?P<path>.*)/$', 'django.views.static.serve',
     {'document_root': MEDIA_URL, 'show_indexes': False}),

Set media URL in your settings file..to

MEDIA_URL = projectDirPath + '/couponRestApiApp/static/'

when you will upload any image it will get stored in the images dir of your app

Leave a comment