[Django]-Python manage.py runserver: TypeError: argument 1 must be str not WindowsPath

9👍

The issue is here

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
                ^^^^^^^^^^^^^^^^^^^^^^^
    }
}

BASE_DIR / 'db.sqlite3' returns a Pathlib object(WindowsPath if you are using windows otherwise PosixPath), where as NAME actually expect a string. So change from

BASE_DIR / 'db.sqlite3

to

str(BASE_DIR / 'db.sqlite3') 

in order to get a string representation of Path object.

Leave a comment