Describe the bug
The makemigrations command fails as it is in the ghostwriter wiki. The socket tries to resolve nginx which does not exist when you are standing up just the django container to make the migrations
To Reproduce
Steps to reproduce the behavior:
- With all containers down run
docker compose -f local.yml run --rm django python manage.py makemigrations
- See error
Traceback (most recent call last):
File "/app/manage.py", line 31, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 382, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 102, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 89, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 217, 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 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/app/config/settings/local.py", line 49, in <module>
_, _, ips = socket.gethostbyname_ex("nginx")
socket.gaierror: [Errno -3] Try again
Expected Behavior
The makemigrations command should run successfully
Additional context
As a work around i added:
try:
_, _, ips = socket.gethostbyname_ex("nginx")
except socket.gaierror:
ips = []
But there is probably a better way of doing this
Describe the bug
The makemigrations command fails as it is in the ghostwriter wiki. The socket tries to resolve nginx which does not exist when you are standing up just the django container to make the migrations
To Reproduce
Steps to reproduce the behavior:
docker compose -f local.yml run --rm django python manage.py makemigrationsExpected Behavior
The makemigrations command should run successfully
Additional context
As a work around i added:
But there is probably a better way of doing this