Getting error on Vercel while trying to deploy Django

Hello everyone, I build my django project and tried to deploy it in vercel. but I get this error message in vercel.
my python version = 3.10.0

this is the error code on vercel

[02:35:58.935] Running build in Washington, D.C., USA (East) – iad1
[02:35:59.090] Cloning github.com/LetcodeitwithDave/BookHaven (Branch: master, Commit: e6ac0c7)
[02:35:59.101] Skipping build cache, deployment was triggered without cache.
[02:36:00.037] Cloning completed: 946.92ms
[02:36:00.592] Running "vercel build"
[02:36:01.084] Vercel CLI 33.5.3
[02:36:01.311] WARN! Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
[02:36:02.677] Collecting asgiref==3.7.2 (from -r requirements.txt (line 1))
[02:36:02.711]   Downloading asgiref-3.7.2-py3-none-any.whl.metadata (9.2 kB)
[02:36:02.741] Collecting certifi==2024.2.2 (from -r requirements.txt (line 2))
[02:36:02.746]   Downloading certifi-2024.2.2-py3-none-any.whl.metadata (2.2 kB)
[02:36:02.841] Collecting charset-normalizer==3.3.2 (from -r requirements.txt (line 3))
[02:36:02.846]   Downloading charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (33 kB)
[02:36:02.866] Collecting dj-database-url==2.1.0 (from -r requirements.txt (line 4))
[02:36:02.901]   Downloading dj_database_url-2.1.0-py3-none-any.whl.metadata (11 kB)
[02:36:03.002] Collecting Django==4.2.10 (from -r requirements.txt (line 5))
[02:36:03.018]   Downloading Django-4.2.10-py3-none-any.whl.metadata (4.1 kB)
[02:36:03.039] Collecting django-browser-reload==1.12.1 (from -r requirements.txt (line 6))
[02:36:03.049]   Downloading django_browser_reload-1.12.1-py3-none-any.whl.metadata (9.8 kB)
[02:36:03.101] Collecting django-cors-headers==4.3.1 (from -r requirements.txt (line 7))
[02:36:03.106]   Downloading django_cors_headers-4.3.1-py3-none-any.whl.metadata (16 kB)
[02:36:03.129] Collecting django-environ==0.11.2 (from -r requirements.txt (line 8))
[02:36:03.139]   Downloading django_environ-0.11.2-py2.py3-none-any.whl.metadata (11 kB)
[02:36:03.164] Collecting django-filter==23.5 (from -r requirements.txt (line 9))
[02:36:03.172]   Downloading django_filter-23.5-py3-none-any.whl.metadata (5.2 kB)
[02:36:03.214] Collecting djangorestframework==3.14.0 (from -r requirements.txt (line 10))
[02:36:03.220]   Downloading djangorestframework-3.14.0-py3-none-any.whl.metadata (10 kB)
[02:36:03.239] Collecting fontawesomefree==6.5.1 (from -r requirements.txt (line 11))
[02:36:03.251]   Downloading fontawesomefree-6.5.1-py3-none-any.whl.metadata (824 bytes)
[02:36:03.280] Collecting gunicorn==21.2.0 (from -r requirements.txt (line 12))
[02:36:03.286]   Downloading gunicorn-21.2.0-py3-none-any.whl.metadata (4.1 kB)
[02:36:03.306] Collecting idna==3.6 (from -r requirements.txt (line 13))
[02:36:03.334]   Downloading idna-3.6-py3-none-any.whl.metadata (9.9 kB)
[02:36:03.367] Collecting Markdown==3.5.2 (from -r requirements.txt (line 14))
[02:36:03.373]   Downloading Markdown-3.5.2-py3-none-any.whl.metadata (7.0 kB)
[02:36:03.404] Collecting packaging==23.2 (from -r requirements.txt (line 15))
[02:36:03.410]   Downloading packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
[02:36:03.636] Collecting pillow==10.2.0 (from -r requirements.txt (line 16))
[02:36:03.642]   Downloading pillow-10.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (9.7 kB)
[02:36:03.729] Collecting psycopg2-binary==2.9.9 (from -r requirements.txt (line 17))
[02:36:03.736]   Downloading psycopg2_binary-2.9.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.4 kB)
[02:36:03.754] Collecting py-postgresql==1.3.0 (from -r requirements.txt (line 18))
[02:36:03.766]   Downloading py-postgresql-1.3.0.tar.gz (273 kB)
[02:36:03.774]      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 273.8/273.8 kB 61.4 MB/s eta 0:00:00
[02:36:03.821]   Installing build dependencies: started
[02:36:06.478]   Installing build dependencies: finished with status 'done'
[02:36:06.480]   Getting requirements to build wheel: started
[02:36:06.659]   Getting requirements to build wheel: finished with status 'done'
[02:36:06.662]   Preparing metadata (pyproject.toml): started
[02:36:06.864]   Preparing metadata (pyproject.toml): finished with status 'done'
[02:36:06.974] Collecting pytz==2024.1 (from -r requirements.txt (line 19))
[02:36:06.980]   Downloading pytz-2024.1-py2.py3-none-any.whl.metadata (22 kB)
[02:36:07.026] Collecting requests==2.31.0 (from -r requirements.txt (line 20))
[02:36:07.031]   Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
[02:36:07.051] Collecting sqlparse==0.4.4 (from -r requirements.txt (line 21))
[02:36:07.057]   Downloading sqlparse-0.4.4-py3-none-any.whl.metadata (4.0 kB)
[02:36:07.084] Collecting typing_extensions==4.10.0 (from -r requirements.txt (line 22))
[02:36:07.090]   Downloading typing_extensions-4.10.0-py3-none-any.whl.metadata (3.0 kB)
[02:36:07.140] Collecting tzdata==2024.1 (from -r requirements.txt (line 23))
[02:36:07.148]   Downloading tzdata-2024.1-py2.py3-none-any.whl.metadata (1.4 kB)
[02:36:07.199] Collecting urllib3==2.2.0 (from -r requirements.txt (line 24))
[02:36:07.205]   Downloading urllib3-2.2.0-py3-none-any.whl.metadata (6.4 kB)
[02:36:07.406] Collecting importlib-metadata>=4.4 (from Markdown==3.5.2->-r requirements.txt (line 14))
[02:36:07.413]   Downloading importlib_metadata-7.0.1-py3-none-any.whl.metadata (4.9 kB)
[02:36:07.562] Collecting zipp>=0.5 (from importlib-metadata>=4.4->Markdown==3.5.2->-r requirements.txt (line 14))
[02:36:07.568]   Downloading zipp-3.17.0-py3-none-any.whl.metadata (3.7 kB)
[02:36:07.603] Downloading asgiref-3.7.2-py3-none-any.whl (24 kB)
[02:36:07.610] Downloading certifi-2024.2.2-py3-none-any.whl (163 kB)
[02:36:07.617]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.8/163.8 kB 63.2 MB/s eta 0:00:00
[02:36:07.631] Downloading charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB)
[02:36:07.637]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 142.3/142.3 kB 51.8 MB/s eta 0:00:00
[02:36:07.643] Downloading dj_database_url-2.1.0-py3-none-any.whl (7.7 kB)
[02:36:07.655] Downloading Django-4.2.10-py3-none-any.whl (8.0 MB)
[02:36:07.738]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.0/8.0 MB 99.2 MB/s eta 0:00:00
[02:36:07.750] Downloading django_browser_reload-1.12.1-py3-none-any.whl (12 kB)
[02:36:07.757] Downloading django_cors_headers-4.3.1-py3-none-any.whl (12 kB)
[02:36:07.767] Downloading django_environ-0.11.2-py2.py3-none-any.whl (19 kB)
[02:36:07.775] Downloading django_filter-23.5-py3-none-any.whl (94 kB)
[02:36:07.780]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 94.4/94.4 kB 35.1 MB/s eta 0:00:00
[02:36:07.789] Downloading djangorestframework-3.14.0-py3-none-any.whl (1.1 MB)
[02:36:07.803]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 101.2 MB/s eta 0:00:00
[02:36:07.812] Downloading fontawesomefree-6.5.1-py3-none-any.whl (25.6 MB)
[02:36:08.067]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 25.6/25.6 MB 79.3 MB/s eta 0:00:00
[02:36:08.073] Downloading gunicorn-21.2.0-py3-none-any.whl (80 kB)
[02:36:08.080]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.2/80.2 kB 30.6 MB/s eta 0:00:00
[02:36:08.085] Downloading idna-3.6-py3-none-any.whl (61 kB)
[02:36:08.091]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 23.9 MB/s eta 0:00:00
[02:36:08.097] Downloading Markdown-3.5.2-py3-none-any.whl (103 kB)
[02:36:08.102]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.9/103.9 kB 41.5 MB/s eta 0:00:00
[02:36:08.107] Downloading packaging-23.2-py3-none-any.whl (53 kB)
[02:36:08.112]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 kB 18.7 MB/s eta 0:00:00
[02:36:08.121] Downloading pillow-10.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB)
[02:36:08.154]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.4/4.4 MB 148.5 MB/s eta 0:00:00
[02:36:08.162] Downloading psycopg2_binary-2.9.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
[02:36:08.187]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 137.8 MB/s eta 0:00:00
[02:36:08.193] Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
[02:36:08.202]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 505.5/505.5 kB 87.8 MB/s eta 0:00:00
[02:36:08.209] Downloading requests-2.31.0-py3-none-any.whl (62 kB)
[02:36:08.215]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 21.5 MB/s eta 0:00:00
[02:36:08.221] Downloading sqlparse-0.4.4-py3-none-any.whl (41 kB)
[02:36:08.229]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.2/41.2 kB 7.7 MB/s eta 0:00:00
[02:36:08.234] Downloading typing_extensions-4.10.0-py3-none-any.whl (33 kB)
[02:36:08.247] Downloading tzdata-2024.1-py2.py3-none-any.whl (345 kB)
[02:36:08.255]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 345.4/345.4 kB 71.2 MB/s eta 0:00:00
[02:36:08.262] Downloading urllib3-2.2.0-py3-none-any.whl (120 kB)
[02:36:08.269]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 120.9/120.9 kB 24.9 MB/s eta 0:00:00
[02:36:08.274] Downloading importlib_metadata-7.0.1-py3-none-any.whl (23 kB)
[02:36:08.283] Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)
[02:36:08.512] Building wheels for collected packages: py-postgresql
[02:36:08.514]   Building wheel for py-postgresql (pyproject.toml): started
[02:36:09.604]   Building wheel for py-postgresql (pyproject.toml): finished with status 'done'
[02:36:09.606]   Created wheel for py-postgresql: filename=py_postgresql-1.3.0-cp39-cp39-linux_x86_64.whl size=289740 sha256=344d157dd7a6ae7629e69b45e085ebd846c96650902fd43171197e7b44e8509b
[02:36:09.606]   Stored in directory: /vercel/.cache/pip/wheels/f3/dd/e4/1cd4eac87031f7697d7ad1bab9c7f27065298256a6846f492f
[02:36:09.610] Successfully built py-postgresql
[02:36:09.879] Installing collected packages: pytz, fontawesomefree, zipp, urllib3, tzdata, typing_extensions, sqlparse, py-postgresql, psycopg2-binary, pillow, packaging, idna, django-environ, charset-normalizer, certifi, requests, importlib-metadata, gunicorn, asgiref, Markdown, Django, djangorestframework, django-filter, django-cors-headers, django-browser-reload, dj-database-url
[02:36:15.068] Successfully installed Django-4.2.10 Markdown-3.5.2 asgiref-3.7.2 certifi-2024.2.2 charset-normalizer-3.3.2 dj-database-url-2.1.0 django-browser-reload-1.12.1 django-cors-headers-4.3.1 django-environ-0.11.2 django-filter-23.5 djangorestframework-3.14.0 fontawesomefree-6.5.1 gunicorn-21.2.0 idna-3.6 importlib-metadata-7.0.1 packaging-23.2 pillow-10.2.0 psycopg2-binary-2.9.9 py-postgresql-1.3.0 pytz-2024.1 requests-2.31.0 sqlparse-0.4.4 typing_extensions-4.10.0 tzdata-2024.1 urllib3-2.2.0 zipp-3.17.0
[02:36:15.071] WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[02:36:15.072] 
[02:36:15.072] [notice] A new release of pip is available: 23.3.2 -> 24.0
[02:36:15.072] [notice] To update, run: pip install --upgrade pip
[02:36:19.272]   File "manage.py", line 17
[02:36:19.273]     ) from exc
[02:36:19.273]          ^
[02:36:19.273] SyntaxError: invalid syntax
[02:36:19.277] Error: Command "./build_files.sh" exited with 1
[02:36:19.525]

I already remove the psycopg2 in the requirements.txt:

asgiref==3.7.2
certifi==2024.2.2
charset-normalizer==3.3.2
dj-database-url==2.1.0
Django==4.2.10
django-browser-reload==1.12.1
django-cors-headers==4.3.1
django-environ==0.11.2
django-filter==23.5
djangorestframework==3.14.0
fontawesomefree==6.5.1
gunicorn==21.2.0
idna==3.6
Markdown==3.5.2
packaging==23.2
pillow==10.2.0
psycopg2-binary==2.9.9
py-postgresql==1.3.0
pytz==2024.1
requests==2.31.0
sqlparse==0.4.4
typing_extensions==4.10.0
tzdata==2024.1
urllib3==2.2.0

this is my build_files.sh

#!/bin/bash

pip install -r requirements.txt
python manage.py collectstatic

this is my manage.py file

#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()

this is my vercel.json

{
    "version": 2,
    "builds": [
      {
        "src": "BookHaven/wsgi.py",
        "use": "@vercel/python",
        "config": { "maxLambdaSize": "15mb", "runtime": "python3.10.0" }
      },
      {
        "src": "build_files.sh",
        "use": "@vercel/static-build",
        "config": {
          "distDir": "staticfiles_build"
        }
      }
    ],
    "routes": [
      {
        "src": "/static/(.*)",
        "dest": "/static/$1"
      },
      {
        "src": "/(.*)",
        "dest": "BookHaven/wsgi.py"
      }
    ]
  }

i tried removing the psycopg2 in the requirements.txt cause i saw it on a blog post on how to fix this but it didn't work:

asgiref==3.7.2
certifi==2024.2.2
charset-normalizer==3.3.2
dj-database-url==2.1.0
Django==4.2.10
django-browser-reload==1.12.1
django-cors-headers==4.3.1
django-environ==0.11.2
django-filter==23.5
djangorestframework==3.14.0
fontawesomefree==6.5.1
gunicorn==21.2.0
idna==3.6
Markdown==3.5.2
packaging==23.2
pillow==10.2.0
psycopg2-binary==2.9.9
py-postgresql==1.3.0
pytz==2024.1
requests==2.31.0
sqlparse==0.4.4
typing_extensions==4.10.0
tzdata==2024.1
urllib3==2.2.0
Back to Top