DEV Community

Discussion on: SOLVED:Uploading images from Django-Admin

Collapse
 
highcenburg profile image
Vicente G. Reyes

Hey Rhett,

Thank you for this. I'm doing a tutorial now and the guy used ImageField which made sense in what I was trying to achieve.

The debug on my project is set to False and the ALLOWED_HOST is set to my localhost. I think the error might be inside the FilePathField line of code. When I use

 image = models.FilePathField(path=os.path.join(settings.BASE_DIR, 'home/projects/static/img'))
it returns the 500 error on the project page, but when I use
image = models.FileField(upload_to='uploads/')
it runs as smooth as silk.

The MEDIA_ROOT & MEDIA_URL would be set now thanks to you.

Cheers!