1

I have a following model for my files:

class Import(models.Model):
     file = models.FileField(upload_to='%Y/%m/%d')

And I save them like this:

f = request.FILES['import']
if f.size < settings.MAX_UPLOAD_SIZE:
    x = Import.objects.create(file=f)

My media root:

MEDIA_ROOT = os.path.join('/home/xyz/project/main', 'upload/')

The problem is, when I inspect my x object like:

print x.file.path

it will return "/home/my-computer-name/..." instead of "/home/xyz/...". What am I doing wrong? Django 1.8, Ubuntu. The file has been uploaded to correct path.

nat
  • 1,511
  • 2
  • 11
  • 7

1 Answers1

1

ok, forget it. I just put wrong settings file when printing the path

nat
  • 1,511
  • 2
  • 11
  • 7