Skip to content

not connect the database docker #3897

@sistemmsn

Description

@sistemmsn

does not connect the database that comes from?

`services:
web:
hostname: web_ralph
platform: linux/amd64
image: allegro/ralph:latest
restart: always
ports:
- "8000"
volumes:
- ralph_media:/var/local/ralph/media
- ralph_static:/usr/share/ralph/static
links:
- db
- redis
- nginx
environment:
DATABASE_NAME: ralph_ng
DATABASE_USER: ralph_ng
DATABASE_PASSWORD: ralph_ng
DATABASE_HOST: db_ralph
REDIS_HOST: redis
REDIS_PASSWORD: ""
REDIS_PORT: 6379
REDIS_DB: 0
networks:
ralph-network:

nginx:
platform: linux/amd64
image: allegro/ralph-static-nginx:latest
restart: always
ports:
- "83:80"
volumes:
- ralph_media:/opt/media
networks:
ralph-network:

db:
platform: linux/amd64
image: mysql:5.7
hostname: db_ralph
environment:
TZ: America/Mexico_City
MYSQL_DATABASE: ralph_ng
MYSQL_ROOT_PASSWORD: ralph_ng
MYSQL_USER: ralph_ng
MYSQL_PASSWORD: ralph_ng
volumes:
- ralph_dbdata:/var/lib/mysql
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
networks:
ralph-network:

redis:
platform: linux/amd64
image: redis:3.0
restart: always
ports:
- "6379"
networks:
ralph-network:

inkpy:
build:
context: ../
dockerfile: docker/Dockerfile-inkpy
platform: linux/amd64
restart: always
links:
- redis:redis
environment:
REDIS_HOST: redis
REDIS_PASSWORD: ""
REDIS_PORT: 6379
REDIS_DB: 0
networks:
ralph-network:

networks:
ralph-network:
driver: bridge

volumes:
ralph_dbdata:
ralph_media:
ralph_static:
`

`web-1 | ==> /var/log/ralph/ralph.log <==
web-1 | [22.04.2025 19:05:51,690] ERROR [MainProcess 31] log - Internal Server Error: /
web-1 | Traceback (most recent call last):
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 199, in _get_session
web-1 | return self._session_cache
web-1 | AttributeError: 'SessionStore' object has no attribute '_session_cache'
web-1 |
web-1 | During handling of the above exception, another exception occurred:
web-1 |
web-1 | Traceback (most recent call last):
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
web-1 | return self.cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 74, in execute
web-1 | return self.cursor.execute(query, args)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 250, in execute
web-1 | self.errorhandler(self, exc, value)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
web-1 | raise errorvalue
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 247, in execute
web-1 | res = self._query(query)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 412, in _query
web-1 | rowcount = self._do_query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 375, in _do_query
web-1 | db.query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 276, in query
web-1 | _mysql.connection.query(self, query)
web-1 | _mysql_exceptions.ProgrammingError: (1146, "Table 'ralph_ng.django_session' doesn't exist")
web-1 |
web-1 | The above exception was the direct cause of the following exception:
web-1 |
web-1 | Traceback (most recent call last):
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
web-1 | response = get_response(request)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
web-1 | response = self.process_exception_by_middleware(e, request)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
web-1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
web-1 | File "/usr/lib/python3.8/contextlib.py", line 75, in inner
web-1 | return func(*args, **kwds)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 249, in wrapper
web-1 | return self.admin_view(view, cacheable)(*args, **kwargs)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
web-1 | response = view_func(request, *args, **kwargs)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
web-1 | response = view_func(request, *args, **kwargs)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 220, in inner
web-1 | if not self.has_permission(request):
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 194, in has_permission
web-1 | return request.user.is_active and request.user.is_staff
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/utils/functional.py", line 224, in inner
web-1 | self._setup()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/utils/functional.py", line 360, in _setup
web-1 | self._wrapped = self._setupfunc()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/middleware.py", line 24, in
web-1 | request.user = SimpleLazyObject(lambda: get_user(request))
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/middleware.py", line 12, in get_user
web-1 | request._cached_user = auth.get_user(request)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/init.py", line 173, in get_user
web-1 | user_id = _get_user_session_key(request)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/init.py", line 58, in _get_user_session_key
web-1 | return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 64, in getitem
web-1 | return self._session[key]
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 204, in _get_session
web-1 | self._session_cache = self.load()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/db.py", line 43, in load
web-1 | s = self._get_session_from_db()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/db.py", line 32, in _get_session_from_db
web-1 | return self.model.objects.get(
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager_method
web-1 | return getattr(self.get_queryset(), name)(*args, **kwargs)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 411, in get
web-1 | num = len(clone)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 258, in len
web-1 | self._fetch_all()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 1261, in _fetch_all
web-1 | self._result_cache = list(self._iterable_class(self))
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 57, in iter
web-1 | results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1154, in execute_sql
web-1 | cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/ralph/lib/metrics/middlewares.py", line 75, in new_execute
web-1 | return old_execute(self, sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 68, in execute
web-1 | return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
web-1 | return executor(sql, params, many, context)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
web-1 | return self.cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit
web-1 | raise dj_exc_value.with_traceback(traceback) from exc_value
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
web-1 | return self.cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 74, in execute
web-1 | return self.cursor.execute(query, args)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 250, in execute
web-1 | self.errorhandler(self, exc, value)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
web-1 | raise errorvalue
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 247, in execute
web-1 | res = self._query(query)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 412, in _query
web-1 | rowcount = self._do_query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 375, in _do_query
web-1 | db.query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 276, in query
web-1 | _mysql.connection.query(self, query)
web-1 | django.db.utils.ProgrammingError: (1146, "Table 'ralph_ng.django_session' doesn't exist")
web-1 | [22.04.2025 19:05:51,786] ERROR [MainProcess 31] middlewares - Exception during collecting metrics
web-1 | Traceback (most recent call last):
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 199, in _get_session
web-1 | return self._session_cache
web-1 | AttributeError: 'SessionStore' object has no attribute '_session_cache'
web-1 |
web-1 | During handling of the above exception, another exception occurred:
web-1 |
web-1 | Traceback (most recent call last):
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
web-1 | return self.cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 74, in execute
web-1 | return self.cursor.execute(query, args)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 250, in execute
web-1 | self.errorhandler(self, exc, value)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
web-1 | raise errorvalue
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 247, in execute
web-1 | res = self._query(query)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 412, in _query
web-1 | rowcount = self._do_query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 375, in _do_query
web-1 | db.query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 276, in query
web-1 | _mysql.connection.query(self, query)
web-1 | _mysql_exceptions.ProgrammingError: (1146, "Table 'ralph_ng.django_session' doesn't exist")
web-1 |
web-1 | The above exception was the direct cause of the following exception:
web-1 |
web-1 | Traceback (most recent call last):
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/ralph/lib/metrics/middlewares.py", line 229, in process_response
web-1 | self._collect_metrics(request, response)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/ralph/lib/metrics/middlewares.py", line 195, in _collect_metrics
web-1 | "username": request.user.username,
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/utils/functional.py", line 224, in inner
web-1 | self._setup()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/utils/functional.py", line 360, in _setup
web-1 | self._wrapped = self._setupfunc()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/middleware.py", line 24, in
web-1 | request.user = SimpleLazyObject(lambda: get_user(request))
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/middleware.py", line 12, in get_user
web-1 | request._cached_user = auth.get_user(request)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/init.py", line 173, in get_user
web-1 | user_id = _get_user_session_key(request)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/auth/init.py", line 58, in _get_user_session_key
web-1 | return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 64, in getitem
web-1 | return self._session[key]
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 204, in _get_session
web-1 | self._session_cache = self.load()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/db.py", line 43, in load
web-1 | s = self._get_session_from_db()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/contrib/sessions/backends/db.py", line 32, in _get_session_from_db
web-1 | return self.model.objects.get(
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager_method
web-1 | return getattr(self.get_queryset(), name)(*args, **kwargs)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 411, in get
web-1 | num = len(clone)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 258, in len
web-1 | self._fetch_all()
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 1261, in _fetch_all
web-1 | self._result_cache = list(self._iterable_class(self))
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/query.py", line 57, in iter
web-1 | results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1154, in execute_sql
web-1 | cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/ralph/lib/metrics/middlewares.py", line 75, in new_execute
web-1 | return old_execute(self, sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 68, in execute
web-1 | return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
web-1 | return executor(sql, params, many, context)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
web-1 | return self.cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit
web-1 | raise dj_exc_value.with_traceback(traceback) from exc_value
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
web-1 | return self.cursor.execute(sql, params)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 74, in execute
web-1 | return self.cursor.execute(query, args)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 250, in execute
web-1 | self.errorhandler(self, exc, value)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
web-1 | raise errorvalue
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 247, in execute
web-1 | res = self._query(query)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 412, in _query
web-1 | rowcount = self._do_query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/cursors.py", line 375, in _do_query
web-1 | db.query(q)
web-1 | File "/opt/ralph/ralph-core/lib/python3.8/site-packages/MySQLdb/connections.py", line 276, in query
web-1 | _mysql.connection.query(self, query)
web-1 | django.db.utils.ProgrammingError: (1146, "Table 'ralph_ng.django_session' doesn't exist")

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions