Opened 8 years ago

Closed 5 years ago

#6352 closed (wontfix)

Admin interface should provide option for allowing the admin to specify the location of the file using a relative path. Currently it only allows the admin to upload a file.

Reported by: mueen@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: admin file FileField upload path
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Here's the scenario I'm suffering from.

My model has a FileField. Basically, I need to create new instances from time to time. Each instance has two files - one about 15 MB and the other about 25 MB.

In the Admin interface, when I try to create a new interface, it wants me to upload the files. If I try that, I get a 500 Error - most likely the process is running out of memory (using FastCGI with Apache).

Now the database does not hold the whole file - only the relative path to it. If I could manually upload the file (FTP, etc), and simply supply the path in the Admin interface, my life would be made easier. As it stands, I have to manually edit the paths in MySQL. So it would be nice if the Admin interface provided both options: Uploading and specifying local paths.

Of course, this solution is not ideal (although it does make handling files more flexible). I'm told the reason I have this problem is that Django tries to keep the whole file in memory before it dumps it to disk. I don't know if there's a ticket open for it, but it would make more sense if Django would write to disk as it reads the file from the upload process. (I'll gladly accept any corrections to my reasoning - I'm Django newbie).

Change History (5)

comment:1 in reply to: ↑ description Changed 8 years ago by Collin Grady <cgrady@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Replying to mueen@nawaz.org:

I'm told the reason I have this problem is that Django tries to keep the whole file in memory before it dumps it to disk. I don't know if there's a ticket open for it, but it would make more sense if Django would write to disk as it reads the file from the upload process.

See #2070 :)

comment:2 Changed 8 years ago by mueen@…

Thanks for the link. As I was using the latest SVN (at the time), and as the patch you refer to has been accepted into trunk, I take it that it was already there when I tried it.

So I'm not sure why I got 500 errors. Perhaps it still required more memory than my shared hosting is willing to provide? I guess I can ask them to increase the memory limits...

In any case, I chose to open this ticket to address the Admin interface. I think that even if the upload issue has been resolved, it is conceivable that the site maintainer may choose to physically move the file for some reason or other, and there should be an easy way to update the FileField information without having to jump into SQL.

This was meant to be more of a feature request than a bug report.

comment:3 Changed 8 years ago by Collin Grady <cgrady@…>

Accepted means it is a valid bug - you'll note that the bug is still open, so it is not in trunk yet.

And I wasn't trying to say this ticket is or isn't valid, just pointing you to the large upload issue :)

comment:4 Changed 8 years ago by Simon Greenhill <dev@…>

  • Triage Stage changed from Unreviewed to Design decision needed

comment:5 Changed 5 years ago by ramiro

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

I think this qualifies as an very edgy case, so I'm closing the ticket as wontfix.

You might want to try overriding the form widget for the form field associated with your model FileField using the documented mechanisms to achieve this (i.e. to be able to edit manually the path of the uploaded file on the server.)

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