SQLite not working
See original GitHub issueI tried setting up a local instance of shynet, to test it, but the setup with SQLite did not work. I uncommented the sqlite settings in the .env template file and commented the postgres settings. I tried the command mentioned in the setup guide (docker run --env-file=.env milesmcc/shynet
), which threw an error:
Performing startup checks...
Running migrations (setting up DB)...
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 209, in get_new_connection
conn = Database.connect(**conn_params)
sqlite3.OperationalError: unable to open database file
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/shynet/./manage.py", line 21, in <module>
main()
File "/usr/src/shynet/./manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 92, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 53, in __init__
self.build_graph()
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 220, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations
if self.has_table():
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 55, in has_table
with self.connection.cursor() as cursor:
File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 259, in cursor
return self._cursor()
File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 235, in _cursor
self.ensure_connection()
File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 218, in ensure_connection
with self.wrap_database_errors:
File "/usr/local/lib/python3.10/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 209, in get_new_connection
conn = Database.connect(**conn_params)
django.db.utils.OperationalError: unable to open database file
Migrations failed, exiting
It threw the same error without mounting the folder with the database file into the container, and it also failed with mounting the database file directly (./database/db.sqlite3:/var/local/shynet/db/db.sqlite3:rw
)
This docker-compose, which should do the same if I’m not mistaken, did also fail with the same error
version: "3.0"
services:
shynet:
image: milesmcc/shynet
container_name: shynet
restart: unless-stopped
ports:
- 8080:8080
volumes:
- ./database/db.sqlite3:/var/local/shynet/db/db.sqlite3:rw
env_file: .env
I have no idea where the problem could be, because I don’t know how django handles databases.
Issue Analytics
- State:
- Created a year ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Why is this SQLite database not working - Stack Overflow
Using Sqlite browser you can open the db file and check the table is created or not. Also uninstall the app and install...
Read more >Serious Sqlite command line Problems after Windows 10 update
After the current WINDOWS 10 update to one of our customers Laptops, the SQLITE command processor began to fail in strange and sometimes ......
Read more >SQLite command line shell stuck on ...> , CTRL+D not working
After searching on the internet, users suggested the solution "CTRL+D", but it doesn't work for me. CTRL+C however just exits sqlite3. My ...
Read more >SQLiteDatabase | Android Developers
This method does not work if any data has been written to the database file, and must be called right after the database...
Read more >Understanding the SQLite AUTOINCREMENT
If this SQLite tutorial saves you hours of work, please whitelist it in your ... CREATE TABLE people ( first_name TEXT NOT NULL,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey, I had the same issue here, I think it’s because you pull from
milesmcc/shynet:latest
in the docker hub.I built the project from the Dockerfile and it worked. 5 months ago this pull request fixed the issue. However, the
latest
tag in docker hub is 9 months old.The
edge
tag seams to be updated more often but it’s not working out of the box for me so the best solution I think is to pull the repo and build from the Dockerfile.Its working with edge docker image for me now 👍