Should I upload images to a static directory in Django?
问题 I have this model containing an image field. from django.db import models from django.contrib.auth.models import User class Customer(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=127) logo = models.ImageField(upload_to='customer/logo', null=True, blank=True) def __str__(self): return self.name In my view, I download the image from the specified url and store it in the image field. For testing, I use a test user as foreign key. import json import urllib