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

Path issue - Django app running inside a docker container #32

Open
mangatinanda opened this issue Jul 18, 2022 · 0 comments
Open

Path issue - Django app running inside a docker container #32

mangatinanda opened this issue Jul 18, 2022 · 0 comments

Comments

@mangatinanda
Copy link

Code in the Django app:

if serializer.validated_data:
    from snapshot_queries import snapshot_queries
    with snapshot_queries() as queries_executed:                
        instance = serializer.save()
    queries_executed.display()

I am getting the following error:

  File "/usr/local/lib/python3.8/contextlib.py", line 74, in inner
    with self._recreate_cm():
  File "/usr/local/lib/python3.8/site-packages/django/db/transaction.py", line 196, in __enter__
    sid = connection.savepoint()
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 332, in savepoint
    self._savepoint(sid)
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 300, in _savepoint
    cursor.execute(self.ops.savepoint_create_sql(sid))
  File "/usr/local/lib/python3.8/site-packages/snapshot_queries/snapshot_queries.py", line 171, in execute
    return self._record(method=self.cursor.execute, sql=sql, params=params)
  File "/usr/local/lib/python3.8/site-packages/snapshot_queries/snapshot_queries.py", line 234, in _record
    Query.create(
  File "/usr/local/lib/python3.8/site-packages/snapshot_queries/query.py", line 72, in create
    location=last_executed_line.location(),
  File "/usr/local/lib/python3.8/site-packages/snapshot_queries/stacktrace.py", line 98, in location
    loc = f"{Path(self.path).relative_to(Path.cwd())}:{self.line_no}"
  File "/usr/local/lib/python3.8/pathlib.py", line 908, in relative_to
    raise ValueError("{!r} does not start with {!r}"
ValueError: '/usr/local/lib/python3.8/contextlib.py' does not start with '/webapps/app'

Any help is much appreciated.

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

1 participant