Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows on flask db migrate: (sqlite3.OperationalError) unable to open database file #20

Open
cshields143 opened this issue Jul 22, 2020 · 0 comments
Assignees
Labels
flask flask instance related

Comments

@cshields143
Copy link

cshields143 commented Jul 22, 2020

Problem

Trying to build the app on Windows 10.

After creating a .env file from .env.example, I tried to initialize the project from the command line like so:

pip install -r requirements/dev.txt
npm install
for /f "tokens=*" %i in (.env) do set %i
flask db init
flask db migrate -m "initial"

At the migrate line, there is a long stack trace, and then this error (even when running the prompt as Administrator):

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
(Background on this error at: http://sqlalche.me/e/13/e3q8)

Proposed Solution

Changing the value of DATABASE_URL in .env from the example default sqlite:////tmp/dev.db to a path I knew I had write access to (in my case, the project directory itself: sqlite:///C:\\Users\\<username-and-path>\\chime2\\dev.db) fixed the issue.

Because the example path assumes a Linux filesystem, can a note be made, maybe in the README, that the value would need to be changed prior to building?

@cshields143 cshields143 added the flask flask instance related label Jul 22, 2020
@BrianThomasRoss BrianThomasRoss self-assigned this Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flask flask instance related
Projects
None yet
Development

No branches or pull requests

2 participants