Re: upload problems
On Wed, Oct 28, 2009 at 9:03 AM, baxter@gretschpages.com <mail.baxter@gmail.com> wrote:
No, it's not that I can't see them on the site. They're not in the
filesystem. They're not there, anywhere, as far as I can see.
I'm pretty sure you'd get an error in the admin if it had any trouble saving the uploaded file. Probably the easiest way to verify the full path that is being used when saving is to put:
import pdb; pdb.set_trace()
at the beginning of the _save() function in django/core/files/storage.py and step through the save code. For example:
> /home/kmt/django/trunk/django/core/files/storage.py(139)_save()
-> full_path = self.path(name)
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(141)_save()
-> directory = os.path.dirname(full_path)
(Pdb) full_path
'/home/kmt/software/web/playground/file_thing_files/1.txt'
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(142)_save()
-> if not os.path.exists(directory):
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(143)_save()
-> os.makedirs(directory)
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(153)_save()
-> while True:
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(154)_save()
-> try:
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(156)_save()
-> if hasattr(content, 'temporary_file_path'):
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(164)_save()
-> fd = os.open(full_path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, 'O_BINARY', 0))
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(165)_save()
-> try:
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(166)_save()
-> locks.lock(fd, locks.LOCK_EX)
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(167)_save()
-> for chunk in content.chunks():
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(168)_save()
-> os.write(fd, chunk)
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(167)_save()
-> for chunk in content.chunks():
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(170)_save()
-> locks.unlock(fd)
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(171)_save()
-> os.close(fd)
(Pdb) n
> /home/kmt/django/trunk/django/core/files/storage.py(181)_save()
-> break
shows this uploaded file was saved to:
'/home/kmt/software/web/playground/file_thing_files/1.txt'
If you do that and still can't see the files on disk after uploading that will be very curious.
I do see some inconsistencies in the settings you mention:
MEDIA_ROOT = '/Users/<myname>/Sites/django-media/'
doesn't quite match:
{'document_root': '/Users/tbaxter/Sites/django-media/ink/',
I assume <myname> is tbaxter but what's the 'ink' on the end? You also mention:
> If I back up to the /media/img/ directory, nothing.
Are 'img' and 'ink' supposed to be the same thing?
But these inconsistencies would just affect being able to see the uploaded files via the browser, they wouldn't have any impact on seeing the files directly in '/Users/<myname>/Sites/django-media/' after uploading.
Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home