from django.db import models
from django.contrib.auth.models import AbstractUser
classUser(AbstractUser):
telephone = models.CharField(max_length=11)
avatar = models.ImageField(upload_to='avatar', default='avatar/default.png')
image-20200716212441930
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
AUTH_USER_MODEL = 'user.user'
image-20200716212608591
image-20200716212739205
image-20200716212936302
from django.contrib import admin
from django.urls import path, re_path
from django.views.static import serve
from django.conf import settings
urlpatterns = [
path('admin/', admin.site.urls),
re_path('media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}),
]