There are a couple of things I don't think you need, which may or may not be causing the problem. I have the following code working perfectly in production (Django 1.5). models.py:
...
decision_file = models.FileField(
upload_to = "guidance",
blank = True,
help_text = "20MB maximum file size."
)
...
And in my base settings.py:
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), '../../media')
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '../../static/')
STATIC_URL = '/static/'
Notice I'm defining separate paths and urls for static and media files. I don't think you should include the format string with % settings.MEDIA_ROOT
in your default (see Paulo Bu's answer) or use the trailing slash in the upload_to
parameter.
In summary
- check the upload folder exists;
- set separate static and media paths and urls;
- remove the format string from your defaul; and
- remove the trailing slash from the
upload_to
parameter
and you should have working code.