in setting.py I already add this code
MEDIA_URL = 'media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
and in urls.py i add this
urlpatterns = [
#my pattern...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
and my model look like this
class WordRoot(models.Model):
root = models.CharField(max_length=64, unique=True, null=False)
pic = models.ImageField(
upload_to='word_root_images/', null=True, blank=True)
def __str__(self):
return self.root
i also create folder media in same directory as static and have word_root_images directory in media
but when I upload picture in pic i get Server Error (500)
any suggestions?