meta.FileType

16 views
Skip to first unread message

Andreas Kostyrka

unread,
Aug 3, 2005, 12:04:27 PM8/3/05
to django...@googlegroups.com
Hi!

Could someone explain in more depth how to use a FileType?

My admin interface shows a File Selection element, but no matter what I enter
the record doesn't get saved. OTOH the admin interface doesn't show any
error messages.

Andreas

Jacob Kaplan-Moss

unread,
Aug 3, 2005, 12:17:48 PM8/3/05
to django...@googlegroups.com

yacc

unread,
Aug 3, 2005, 12:46:45 PM8/3/05
to Django users
Well, that doesn't completly solve my problems:

~$ grep FileField downman/apps/downman/models/downman.py
meta.FileField('data', upload_to="upload"),
~$ grep MEDIA downman/settings/*.py
downman/settings/admin.py:ADMIN_MEDIA_PREFIX = '/media/'
downman/settings/main.py:MEDIA_ROOT = '/tmp/'
downman/settings/main.py:# URL that handles the media served from
MEDIA_ROOT.
downman/settings/main.py:MEDIA_URL = '/media/'

Even curiouser is the fact that pressing 'Save' on an empty form
doesn't give any errors either.

That leaves the question: If something bad happens -> where are the
tracebacks?

Andreas

Jacob Kaplan-Moss

unread,
Aug 3, 2005, 1:17:26 PM8/3/05
to django...@googlegroups.com
On Aug 3, 2005, at 11:46 AM, yacc wrote:
> meta.FileField('data', upload_to="upload"),

OK, that looks good.

> downman/settings/admin.py:ADMIN_MEDIA_PREFIX = '/media/'
> downman/settings/main.py:MEDIA_ROOT = '/tmp/'
> downman/settings/main.py:MEDIA_URL = '/media/'

MEDIA_URL probably should be a complete URL prefix (i.e. "http://
example.com/media/") but what you've got should work.

Is admin.py importing the settings from main?

> Even curiouser is the fact that pressing 'Save' on an empty form
> doesn't give any errors either.

Does your web user have write access to MEDIA_ROOT? Since it's "/
tmp/" it probably does, but you should check anyway... Are you sure
that your OS isn't clearing out /tmp on you?

> That leaves the question: If something bad happens -> where are the
> tracebacks?

That's a good question; I'm not sure if the code indeed raises a
exception if the file can't be written; I'll look into that.

Jacob

yacc

unread,
Aug 3, 2005, 1:59:22 PM8/3/05
to Django users
admin.py is importing main ;)

Well, it's running as my user (non-root) with runserver, and
/tmp/upload is a directory
that I've created before (and no, it didn't work before I've created it
either).

What makes me wonder is, that nothing (neither the runserver output,
nor the created webpage) indicate an error. Which suggests either a
try: except: block that kills any exceptions, and/or an unexpected path
in the source :(

Andreas

Jacob Kaplan-Moss

unread,
Aug 3, 2005, 2:29:43 PM8/3/05
to django...@googlegroups.com
On Aug 3, 2005, at 12:59 PM, yacc wrote:
> admin.py is importing main :)

Just checking; I've made that mistake more times than I can count.
Hmm, so this is sounding tricky... do you mind filing a ticket in
http://code.djangoproject.com/? Please include what OS you're using,
what server setup (mod_python? WSGI?) you're using, and the contents
of your settings and model files.

Jacob
Reply all
Reply to author
Forward
0 new messages