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

后端 未结 8 510

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:06

    TO ANY WINDOWS USERS:

    I got the same error while creating my first django project. I couldn't use sudo on windows, so the command python manage.py runserver only worked when I ran my terminal as administrator.

    0 讨论(0)
  • 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')
            )
        )
    }
    
    0 讨论(0)
提交回复
热议问题