How do you put a file in a fixture in Django?
问题 I can easily fill the field of a FileField or ImageField in a Django fixture with a file name, but that file doesn't exist and when I try to test my application it fails because that file doesn't exist. How do I correctly populate a FileField or Imagefield in a Django fixture so that the file itself is available too? 回答1: I'm afraid the short answer is that you can't do this using the FileField or ImageField classes; they just store a file path and have no real concept of the file's actual