SOLVED:Uploading images from Django-Admin

highcenburg profile image Vicente G. Reyes Updated on ・1 min read

I'm almost done fixing my Django portfolio when I bumped into a problem when choosing a photo for one of the pages of my site

The problem here is the dropdown doesn't show anything!

My models.py is

from django.db import models

class Project(models.Model):
    title = models.CharField(max_length=100)
    description = models.TextField()
    technology = models.CharField(max_length=20)
    image = models.FilePathField(path='/img')

I have an /img folder on the main project folder and the static folder.

Someone from StackOverflow asked if I had read & write access on the folder and I definitely have.

Did I miss anything?


markdown guide

Hi Periklis, I'm having a hard time understanding and I think it's better if I send you a video of my issue with choosing a file. Please check this: s3.amazonaws.com/django-error/prob...


I saw the video. But it doesnt say a lot to me.This might not work for too many reasons. Can you please do the process as described in various articles and on django docs, and if you still cant make it, please come back withwhat you did and the errors you get.



I am not sure what you are trying to do, What setup you already have, What errors are thrown, Can you please elaborate?

I actually found a workaround until I figure out the problem. Im trying to get the photo show up on the dropdown but when I click it, nothing shows even if the files are on the right folder


Great! I've been wondering what I was missing on my code to upload files from the admin. Will check this the first thing tomorrow. Cheers!


What I'm trying to do is I'm trying to upload images from the admin and access it thru this dropdown(seen on the video/photo) but when I click it, it does not show anything.


What do the logs say? I am afraid I cannot help with guessing. :)

When I use this

image = models.FileField(upload_to='static/')
it returns a
Server Error (500)
on the admin.

When I use
image = models.FileField("/img")
It return a
Server Error (500)
on the site.

When I use
models.FilePathField(path=os.path.join(settings.BASE_DIR, 'home/projects/static/img'))
it returns a
Server Error (500)
on the admin.

Im confused. I just want to upload images from the admin to the portfolio page of my site.

As explained a couple of times above, those are generic errors and without more specific info or code I am afraid I cannot be of much help, if my only weapon is guessing.

There are various tutorials online. Please have a look and if you have any specific questions please ask again.

A great tutorial that will help: wsvincent.com/django-image-uploads/


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.



Hi! I am currently working on this same project and I have the same issue. I've searched the internet (how I found this post) but couldn't get a clear solution. How did you resolve it? Thanks.