You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found a bug? Please fill out the sections below. 馃憤
Issue Summary
I was following the steps in the contribution guidelines to get the local development setup running.
I was trying to use the approach with Docker Compose. Unfortunately I get the following error:
% docker-compose exec web django-admin runserver 0.0.0.0:8000
Traceback (most recent call last):
File "/venv/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super().execute(*args, **options)
File "/venv/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 68, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tests'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/bin/django-admin", line 8, in <module>
sys.exit(execute_from_command_line())
File "/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.10/site-packages/django/core/management/base.py", line 367, in run_from_argv
connections.close_all()
File "/venv/lib/python3.10/site-packages/django/db/utils.py", line 208, in close_all
for alias in self:
File "/venv/lib/python3.10/site-packages/django/utils/connection.py", line 73, in __iter__
return iter(self.settings)
File "/venv/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/venv/lib/python3.10/site-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/venv/lib/python3.10/site-packages/django/db/utils.py", line 144, in configure_settings
databases = super().configure_settings(databases)
File "/venv/lib/python3.10/site-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tests'
Good catch! This is because /app in the container doesn't end up on sys.path when running django-admin, the first entry ends up being /venv/bin/ instead.
We either need to set PYTHONPATH=/app or update the docs to something like the following, which fixes it:
docker compose exec web python -m django runserver 0.0.0.0:8000
Found a bug? Please fill out the sections below. 馃憤
Issue Summary
I was following the steps in the contribution guidelines to get the local development setup running.
I was trying to use the approach with Docker Compose. Unfortunately I get the following error:
Steps to Reproduce
Follow setup steps in contribution guidelines: https://github.com/torchbox/django-pattern-library/blob/main/CONTRIBUTING.md#docker-compose
Technical details
All versions should be determined by the containers.
The text was updated successfully, but these errors were encountered: