Opened 9 years ago

Closed 9 years ago

#2423 closed defect (worksforme)

Admin uploads go to admin media folder, not MEDIA_ROOT

Reported by: Tyson Tate <tyson@…> Owned by: adrian
Component: contrib.admin Version: master
Severity: normal Keywords: upload_to
Cc: tyson@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I have the following settings in my settings.py file:

MEDIA_ROOT = '/Users/ttate/Desktop/fallingbullets/project-media/'
MEDIA_URL = 'http://localhost:8000/project-media/'
ADMIN_MEDIA_PREFIX = '/media/'

I also have a model with the following:

image = models.ImageField(upload_to="portfolio", core=True)

When I use the admin interface to upload an image, it gets placed in /media/portfolio and not /project-media/portfolio, where it should have gone.

Change History (4)

comment:1 Changed 9 years ago by Tyson Tate <tyson@…>

  • Cc tyson@… added

comment:2 Changed 9 years ago by Tyson Tate <tyson@…>

After deleting all uploaded images and their associated database entries, uploads are completely broken. Uploading appears to work, but no files are actually uploaded to the media directories. The console gives no error messages at all.

comment:3 Changed 9 years ago by Tyson Tate <tyson@…>

Reverting to the following settings seems to make things work. I hope. :/

MEDIA_ROOT = '/Users/ttate/Desktop/fallingbullets/media/'
MEDIA_URL = 'http://localhost:8000/media/'
ADMIN_MEDIA_PREFIX = '/media/admin/'

comment:4 Changed 9 years ago by Tyson Tate <tyson@…>

  • Resolution set to worksforme
  • Status changed from new to closed

No one on IRC was able to reproduce this problem, so I'm marking as worksforme until it comes around and bites me, again. Hopefully I'll have better debug info about why it happens next time.

Note: See TracTickets for help on using tickets.
Back to Top