django.db.utils.OperationalError: unable to open database file

后端 未结 8 533

When I run

python manage.py runserver

I get this error

File \"/usr/local/lib/python2.7/dist-packages/Django-1.10.1-py2.7.egg/django

8条回答
  •  醉酒成梦
    2020-12-10 17:07

    Just remove the first db in your settings.py file.

    You have os.path.join(BASE_DIR, 'db/db.sqlite3') if you remove the first db, you'll have os.path.join(BASE_DIR, 'db.sqlite3')

    Your database settings will be

    DATABASES = {
        'default': dj_database_url.config(
            default="sqlite:///{}".format(
                os.path.join(BASE_DIR, 'db.sqlite3')
            )
        )
    }
    

提交回复
热议问题