Información de error:

Exception Type: ConnectionError at /admin/items/country/add/
Exception Value: ConnectionError (<urllib3.connection.HTTPConnection 
object at 0x111377110>: Failed to establish a new connection: [Errno 
61] Connection refused) caused by: 
NewConnectionError(<urllib3.connection.HTTPConnection object at 
0x111377110>: Failed to establish a new connection: [Errno 61] 
Connection refused)

Recibo este error de conexión mientras guardo la publicación del administrador de Django. Tengo una base de datos MYSQL con configuraciones

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'mystic_db',
        'USER': 'root',
        'PASSWORD': '*****',
        'HOST': '',
        'PORT': '',

Soy un novato en Django Python. Por favor, solicite una solución a este problema.

Rastrear:

File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper 616. return self.admin_site.admin_view(view)(*args, **kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view 110. response = view_func(request, *args, **kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 57. response = view_func(request, *args, **kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner 233. return view(request, *args, **kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/contrib/admin/options.py" in add_view 1516. return self.changeform_view(request, None, form_url, extra_context) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper 34. return bound_func(*args, **kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view 110. response = view_func(request, *args, **kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func 30. return func.get(self, type(self))(*args2, **kwargs2) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/utils/decorators.py" in inner 145. return func(*args, **kwargs) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/contrib/admin/options.py" in changeform_view 1467. self.save_model(request, new_object, form, not add) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/contrib/admin/options.py" in save_model 1078. obj.save() File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/db/models/base.py" in save 710. force_update=force_update, update_fields=update_fields) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/db/models/base.py" in save_base 747. update_fields=update_fields, raw=raw, using=using) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/django/dispatch/dispatcher.py" in send 201. response = receiver(signal=self, sender=sender, **named) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/haystack/signals.py" in handle_save 52. index.update_object(instance, using=using) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/haystack/indexes.py" in update_object 284. backend.update(self, [instance]) File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py" in update 190. bulk(self.conn, prepped_docs, index=self.index_name, doc_type='modelresult') File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/elasticsearch/helpers/init.py" in bulk 188. for ok, item in streaming_bulk(client, actions, **kwargs): File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/elasticsearch/helpers/init.py" in streaming_bulk 160. for result in _process_bulk_chunk(client, bulk_actions, raise_on_exception, raise_on_error, **kwargs): File "/Users/MacbookAir/myproject/lib/python2.7/site-packages/elasticsearch/helpers/init.py" in _process_bulk_chunk 89. raise e

Exception Type: ConnectionError at /admin/items/country/add/
Exception Value: ConnectionError (<urllib3.connection.HTTPConnection 
object at 0x111377110>: Failed to establish a new connection: [Errno 
61] Connection refused) caused by: 
NewConnectionError(<urllib3.connection.HTTPConnection object at 
0x111377110>: Failed to establish a new connection: [Errno 61] 
Connection refused)
respuesta

supongo que su base de datos está alojada localmente

así que intente cambiar esto en su archivo de configuración para la base de datos

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'mystic_db',
        'USER': 'root',
        'PASSWORD': '*****',
        'HOST': '127.0.0.1', or localhost whatever you prefer
        'PORT': '',
}
}

Este fue un problema debido a la instalación incorrecta de la búsqueda elástica que estaba usando junto con el módulo haystack. La búsqueda elástica se crea con Java y requiere al menos Java 8 para ejecutarse. Una vez que instalé lo mismo, el error de conexión urllib3.connection.HTTPConnection salió bien.