简体   繁体   中英

sqlite3 — can't open database file

For background, I'm trying to migrate my sqlite3 local db to a postgresql db on Heroku.

I have no problem accessing the db locally through my (Django) development server. However, when I try to push the db to Heroku, it says it can't open the file.

heroku db:push sqlite://path/to/db --confirm my-app-name

I get the following message:

Loaded Taps v0.3.23
Warning: Data in the app 'my-app-name' will be overwritten and will not be recoverable.
Failed to connect to database:
      Sequel::DatabaseConnectionError -> SQLite3::CantOpenException: could not open database: unable to open database file

Most everything I've seen on Google relates to some bugs in earlier versions of Tap. Otherwise, I'm not sure what I should do here.

I've tried following the advice of this question and others about permissions, but I have full read and write access to the file and containing folder. I'm not too experienced with permissions -- do I need to switch ownership of the db to another user?

If /path/to/database is an absolute path, you need to do:

heroku db:push sqlite:///path/to/db --confirm my-app-name

Note the third slash. It could also be a permissions issue, in which case you want to either change the owner to the current user, or give at least read permission to the database (644).

我会尝试通过dumpdata将数据从sqlite3保存到固定装置,然后在切换到postgres之后,通过loaddata再次加载。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM