Django App - Heroku Deployment error

I am deploying my Django app to heroku using git push heroku master but I am getting the error below. In my system (mac OS) mysql is already installed.

git push heroku master
Enumerating objects: 273, done.
Counting objects: 100% (273/273), done.
Delta compression using up to 8 threads
Compressing objects: 100% (254/254), done.
Writing objects: 100% (273/273), 1.06 MiB | 15.08 MiB/s, done.
Total 273 (delta 127), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (127/127), done.
remote: Updated 98 paths from 9526f96
remote: Compressing source files… done.
remote: Building source:
remote: -----> Building on the Heroku-22 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the buildpack default: python-3.12.2
remote: To use a different version, see: Specifying a Python Runtime | Heroku Dev Center
remote: -----> Installing python-3.12.2
remote: -----> Installing pip 24.0, setuptools 69.2.0 and wheel 0.43.0
remote: -----> Installing dependencies with Pipenv 2023.12.1
remote: Installing dependencies from Pipfile.lock (9fad13)…
remote: -----> Installing SQLite3
remote: -----> $ python collectstatic --noinput
remote: Traceback (most recent call last):
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/db/backends/mysql/”, line 15, in
remote: import MySQLdb as Database
remote: ModuleNotFoundError: No module named ‘MySQLdb’
remote: The above exception was the direct cause of the following exception:
remote: Traceback (most recent call last):
remote: File “/tmp/build_f0c98e12/”, line 22, in
remote: main()
remote: File “/tmp/build_f0c98e12/”, line 18, in main
remote: execute_from_command_line(sys.argv)
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/core/management/”, line 442, in execute_from_command_line
remote: utility.execute()
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/core/management/”, line 416, in execute
remote: django.setup()
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/”, line 24, in setup
remote: apps.populate(settings.INSTALLED_APPS)
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/apps/”, line 116, in populate
remote: app_config.import_models()
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/apps/”, line 269, in import_models
remote: self.models_module = import_module(models_module_name)
remote: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
remote: File “/app/.heroku/python/lib/python3.12/importlib/”, line 90, in import_module
remote: return _bootstrap._gcd_import(name[level:], package, level)
remote: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
remote: File “”, line 1387, in _gcd_import
remote: File “”, line 1360, in _find_and_load
remote: File “”, line 1331, in _find_and_load_unlocked
remote: File “”, line 935, in _load_unlocked
remote: File “”, line 995, in exec_module
remote: File “”, line 488, in _call_with_frames_removed
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/contrib/sessions/”, line 1, in
remote: from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/contrib/sessions/”, line 26, in
remote: class AbstractBaseSession(models.Model):
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/db/models/”, line 143, in new
remote: new_class.add_to_class(“_meta”, Options(meta, app_label))
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/db/models/”, line 371, in add_to_class
remote: value.contribute_to_class(cls, name)
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/db/models/”, line 243, in contribute_to_class
remote: self.db_table, connection.ops.max_name_length()
remote: ^^^^^^^^^^^^^^
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/utils/”, line 15, in getattr
remote: return getattr(self._connections[self._alias], item)
remote: ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/utils/”, line 62, in getitem
remote: conn = self.create_connection(alias)
remote: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/db/”, line 193, in create_connection
remote: backend = load_backend(db[“ENGINE”])
remote: ^^^^^^^^^^^^^^^^^^^^^^^^^^
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/db/”, line 113, in load_backend
remote: return import_module(“%s.base” % backend_name)
remote: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
remote: File “/app/.heroku/python/lib/python3.12/importlib/”, line 90, in import_module
remote: return _bootstrap._gcd_import(name[level:], package, level)
remote: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
remote: File “/app/.heroku/python/lib/python3.12/site-packages/django/db/backends/mysql/”, line 17, in
remote: raise ImproperlyConfigured(
remote: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
remote: Did you install mysqlclient?
remote: ! Error while running ‘$ python collectstatic --noinput’.
remote: See traceback above for details.
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote: Django and Static Assets | Heroku Dev Center
remote: ! Push rejected, failed to compile Python app.
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: f20bb27513068e7894c789e59ff040a6e7ae1310
remote: !
remote: ! We have detected that you have triggered a build from source code with version f20bb27513068e7894c789e59ff040a6e7ae1310
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku :main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! Duplicate Build Version Detected | Heroku Dev Center
remote: Verifying deploy…
remote: ! Push rejected to vinbuy-prod.


In my Pipfile and Pipfile.lock “mysqlclient” dependencies are not present, eventhough mysqlclient is installed in my virtual environment.