project:test03
app:blog
models.py 创建一个blog_user表 字段为username和headImg
class User(models.Model): username = models.CharField(max_length=30) headImg = models.FileField(upload_to='./upload/') ipload写上传文件的路径 def __unicode__(self): return self.username
2. 修改settings.py 指文件放置的根目录
MEDIA_ROOT = '/tmp'
3. 把blog_user表注册到admin后台
from django.contrib import adminfrom blog.models import Useradmin.site.register(User)