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

cant run migrate script in docker #342

Open
sloev opened this issue Feb 5, 2025 · 1 comment
Open

cant run migrate script in docker #342

sloev opened this issue Feb 5, 2025 · 1 comment

Comments

@sloev
Copy link

sloev commented Feb 5, 2025

error:

shynet        | Traceback (most recent call last):
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
shynet        |     self.connect()
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
shynet        |     return func(*args, **kwargs)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 263, in connect
shynet        |     self.connection = self.get_new_connection(conn_params)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
shynet        |     return func(*args, **kwargs)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 167, in get_new_connection
shynet        |     conn = Database.connect(**conn_params)
shynet        | sqlite3.OperationalError: unable to open database file
shynet        | 
shynet        | The above exception was the direct cause of the following exception:
shynet        | 
shynet        | Traceback (most recent call last):
shynet        |   File "/usr/src/shynet/./manage.py", line 21, in <module>
shynet        |     main()
shynet        |   File "/usr/src/shynet/./manage.py", line 17, in main
shynet        |     execute_from_command_line(sys.argv)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
shynet        |     utility.execute()
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
shynet        |     self.fetch_command(subcommand).run_from_argv(self.argv)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
shynet        |     self.execute(*args, **cmd_options)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
shynet        |     output = self.handle(*args, **options)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 96, in wrapped
shynet        |     res = handle_func(*args, **kwargs)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 114, in handle
shynet        |     executor = MigrationExecutor(connection, self.migration_progress_callback)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 18, in __init__
shynet        |     self.loader = MigrationLoader(self.connection)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 58, in __init__
shynet        |     self.build_graph()
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 235, in build_graph
shynet        |     self.applied_migrations = recorder.applied_migrations()
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 81, in applied_migrations
shynet        |     if self.has_table():
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 57, in has_table
shynet        |     with self.connection.cursor() as cursor:
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
shynet        |     return func(*args, **kwargs)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 323, in cursor
shynet        |     return self._cursor()
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 299, in _cursor
shynet        |     self.ensure_connection()
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
shynet        |     return func(*args, **kwargs)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 281, in ensure_connection
shynet        |     with self.wrap_database_errors:
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
shynet        |     raise dj_exc_value.with_traceback(traceback) from exc_value
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
shynet        |     self.connect()
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
shynet        |     return func(*args, **kwargs)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/base/base.py", line 263, in connect
shynet        |     self.connection = self.get_new_connection(conn_params)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
shynet        |     return func(*args, **kwargs)
shynet        |   File "/usr/local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 167, in get_new_connection
shynet        |     conn = Database.connect(**conn_params)
shynet        | django.db.utils.OperationalError: unable to open database file
shynet        | Migrations failed, exiting

docker-compose service:



  shynet:
    container_name: shynet
    image: milesmcc/shynet:edge
    restart: unless-stopped

    env_file:
      - ./services/shynet/environment.env
    environment:
      - SQLITE=True
    volumes:
      - ./services/shynet/db:/var/local/shynet/db:rw
   

file tree:

services
| - shynet 
|        | environment.env

@cisko3000
Copy link

Have you tried it with a docker volume instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants