Django中的上传路径错误

我已经在URL.py中配置了Django3.0 / Ubuntu 18 / NginX Media根目录:

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

在Nginx中:

server {
    listen 80;
    server_name XXXXX.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/user/proj;
    }
    location /media/ {
        root /home/user/proj;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/proj_gunicorn.sock;
    }
}

and in models, I have some FileField and ImageField with 'upload_to ' attribute. When I upload something through admin, everything is okay and files will be uploaded in sub-folders (eg. media/2020/avatar/1.jpg) but when I do that through forms, files will be uploaded in right sub-directories but the image (or file) URL shows the root of media (eg. media/1.jpg) and when I click on URL, it returns 404. I can not figure out why this is happening, I've used this config in dozens of web sites and they work like a charm. Any ideas?