目录
3-2 TEMPLATES 下 'django.template.context_processors.media',
一、模型
可对字段设定为FileField 或者 ImageField
class UserInfo(AbstractUser): nid = models.AutoField(primary_key=True) phone = models.CharField(max_length=32, null=True) create_date = models.DateTimeField(auto_now_add=True) blog = models.OneToOneField(to='Blog', to_field='nid', null=True) avatar = models.FileField(upload_to='avatar/', default='/static/img/default.png')
二、media文件夹建立(手动或者自动)