Django caused Unable to connect with Docker
In your requirements.txt, change kombo version to 3.0.30. This will solve the first error:
I've just reproduced your steps. By doing docker logs some-django-app I've seen this:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 303, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/src/app/i5k/__init__.py", line 5, in <module>
from .celery import app as celery_app
File "/usr/src/app/i5k/celery.py", line 5, in <module>
from celery import Celery
File "/usr/local/lib/python2.7/site-packages/celery/__init__.py", line 130, in <module>
from celery import five
File "/usr/local/lib/python2.7/site-packages/celery/five.py", line 149, in <module>
from kombu.utils.compat import OrderedDict # noqa
File "/usr/local/lib/python2.7/site-packages/kombu/utils/__init__.py", line 19, in <module>
from uuid import UUID, uuid4 as _uuid4, _uuid_generate_random
ImportError: cannot import name _uuid_generate_random
And it seems to be exactly this issue.
As you fix the kombo version, a new error will appear (checked by using docker logs):
[root@:/.../django-blast]# docker logs test
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 112, in create
mod = import_module(mod_path)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/site-packages/django/contrib/postgres/apps.py", line 7, in <module>
from .signals import register_hstore_handler
File "/usr/local/lib/python2.7/site-packages/django/contrib/postgres/signals.py", line 1, in <module>
from psycopg2 import ProgrammingError
ImportError: No module named psycopg2
And it seems that the package you don't want to use is needed...
# grep -ir psycopg2
webapollo/models.py:import psycopg2
webapollo/models.py: conn = psycopg2.connect('dbname=' + self.db_name + ' user=' + self.db_acct + ' host=' + self.host)
webapollo/models.py: conn = psycopg2.connect('dbname=' + species.db_name + ' user=' + species.db_acct + ' host=' + species.host)
webapollo/models.py: conn = psycopg2.connect('dbname=' + species.db_name + ' user=' + species.db_acct + ' host=' + species.host)
i5k/settings_prod.py: 'ENGINE': 'django.db.backends.postgresql_psycopg2',
i5k/settings.py: 'ENGINE': 'django.db.backends.postgresql_psycopg2',
You can keep working at this way or just do a full migration to newer python versions.