I am working on updating an old Django 2.2 app, and am running into an issue with the connections between Celery, Django, Docker, and Redis. I am using Docker Compose to build the app, and using Celery to schedule tasks with Redis as a backend. Celery schedules emails to be sent and I am able to receive those emails, so I am pretty sure that Celery is properly connected to Redis. When running django.contrib.auth.login(), I run into an error TypeError: Cannot create property 'status' on string 'ConnectionError at /api/auth/registration/register_pro/ Error 99 connecting to localhost:6379. Cannot assign requested address
. The error message prints all the config and environment variables of the Django app, and it shows that everywhere in the app redis_url, result_backend, and broker_url are configured as redis://<NO_USERNAME_HERE>:<REDIS_PASSWORD>@redis:6379
. This should be the correct URL since it works for Celery, but it doesn’t work for Django, which searches for Redis on localhost. I’ve searched the entire app for any references to localhost, but there are none.
I’ve tried adding and removing env variables, changing the Django config, running Django in development and production environments, building my own Redis docker image, tweaking redis.conf, and so many other suggested fixes on Stackoverflow, GitHub Issues, and ChatGPT. I don’t know where to continue from here.
Cache config in Django:
REDIS_HOST = get_env_variable('REDIS_HOST')
REDIS_PORT = get_env_variable('REDIS_PORT')
REDIS_PASSWORD = get_env_variable('REDIS_PASSWORD')
REDIS_URL = 'redis://:%s@%s:%s' % (REDIS_PASSWORD, REDIS_HOST, REDIS_PORT)
CACHES = {
'default': {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': REDIS_URL,
'OPTIONS': {
'DB': 3,
},
},
}
Django console error message:
TypeError: Cannot create property 'status' on string 'ConnectionError at /api/auth/registration/register_pro/
Error 99 connecting to localhost:6379. Cannot assign requested address.
Request Method: POST
Request URL: https://myapp.com/api/auth/registration/register_pro/
Django Version: 2.2.28
Python Executable: /usr/local/bin/uwsgi
Python Version: 3.8.19
Python Path: ['/usr/src/app', '.', '', '/usr/bin/python3.8', '/usr/src/app/vault', '/usr/src/app/vault/apps', '/usr/local/lib/python38.zip', '/usr/local/lib/python3.8', '/usr/local/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/site-packages', '/var/www/myapp/vault', '/var/www/myapp/vault/config', '/var/www/myapp/vault/apps']
Server time: Mon, 15 Jul 2024 19:35:17 -0400
Installed Applications:
['django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.redirects',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.flatpages',
'ajax_form',
'compressor',
'django_ses',
'djrill',
'restless',
'storages',
'sorl.thumbnail',
'unfriendly',
'widget_tweaks',
'rest_framework',
'rest_framework.authtoken',
'accounts',
'administrators',
'clients',
'comments',
'companies',
'creditcard',
'documents',
'emails',
'esign',
'facades',
'tabs',
'merchants',
'pfsgen',
'professionals',
'rest_auth',
'svcore',
'users',
'debug_toolbar',
'sslserver']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
'svcore.middleware.MultiSiteMiddleware',
'svcore.middleware.CheckAccessLevelMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware']
Traceback:
File "/usr/local/lib/python3.8/site-packages/redis/connection.py" in connect
559. sock = self._connect()
File "/usr/local/lib/python3.8/site-packages/redis/connection.py" in _connect
615. raise err
File "/usr/local/lib/python3.8/site-packages/redis/connection.py" in _connect
603. sock.connect(socket_address)
During handling of the above exception ([Errno 99] Cannot assign requested address), another exception occurred:
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py" in wrapped_view
54. return view_func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/generic/base.py" in view
71. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py" in dispatch
509. response = self.handle_exception(exc)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py" in handle_exception
469. self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py" in raise_uncaught_exception
480. raise exc
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py" in dispatch
506. response = handler(request, *args, **kwargs)
File "/usr/src/app/vault/apps/rest_auth/views.py" in post
203. login(self.request, self.serializer.user)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/__init__.py" in login
108. request.session.cycle_key()
File "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py" in cycle_key
297. self.create()
File "/usr/local/lib/python3.8/site-packages/redis_sessions/session.py" in create
127. self._session_key = self._get_new_session_key()
File "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py" in _get_new_session_key
152. if not self.exists(session_key):
File "/usr/local/lib/python3.8/site-packages/redis_sessions/session.py" in exists
123. return self.server.exists(self.get_real_stored_key(session_key))
File "/usr/local/lib/python3.8/site-packages/redis/client.py" in exists
1581. return self.execute_command('EXISTS', *names)
File "/usr/local/lib/python3.8/site-packages/redis/client.py" in execute_command
898. conn = self.connection or pool.get_connection(command_name, **options)
File "/usr/local/lib/python3.8/site-packages/redis/connection.py" in get_connection
1192. connection.connect()
File "/usr/local/lib/python3.8/site-packages/redis/connection.py" in connect
563. raise ConnectionError(self._error_message(e))
Exception Type: ConnectionError at /api/auth/registration/register_pro/
Exception Value: Error 99 connecting to localhost:6379. Cannot assign requested address.
Request information:
USER: AnonymousUser
GET: No GET data
POST: No POST data
FILES: No FILES data
COOKIES:
<...>
META:
CONTENT_LENGTH = '235'
CONTENT_TYPE = 'application/json;charset=UTF-8'
CSRF_COOKIE = <cookie>
DOCUMENT_ROOT = '/etc/nginx/html'
HTTPS = 'on'
HTTP_ACCEPT = 'application/json, text/plain, */*'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br, zstd'
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.9'
HTTP_CONNECTION = 'keep-alive'
HTTP_CONTENT_LENGTH = '235'
HTTP_CONTENT_TYPE = 'application/json;charset=UTF-8'
HTTP_COOKIE = <cookie>
HTTP_HOST = 'myapp.com'
HTTP_ORIGIN = 'https://myapp.com'
HTTP_REFERER = 'https://myapp.com/registration/pro'
HTTP_SEC_CH_UA = '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"'
HTTP_SEC_CH_UA_MOBILE = '?0'
HTTP_SEC_CH_UA_PLATFORM = '"Windows"'
HTTP_SEC_FETCH_DEST = 'empty'
HTTP_SEC_FETCH_MODE = 'cors'
HTTP_SEC_FETCH_SITE = 'same-origin'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
HTTP_X_CSRFTOKEN = <cookie>
PATH_INFO = '/api/auth/registration/register_pro/'
QUERY_STRING = ''
REMOTE_ADDR = <ipaddress>
REMOTE_PORT = '65455'
REQUEST_METHOD = 'POST'
REQUEST_URI = '/api/auth/registration/register_pro/'
SCRIPT_NAME = ''
SERVER_NAME = 'myapp.com'
SERVER_PORT = '443'
SERVER_PROTOCOL = 'HTTP/1.1'
uwsgi.node = b'c995ce43f2cc'
uwsgi.version = b'2.0.26'
wsgi.errors = <_io.TextIOWrapper name=2 mode='w' encoding='UTF-8'>
wsgi.file_wrapper = ''
wsgi.input = <uwsgi._Input object at 0x7cc3c057fa70>
wsgi.multiprocess = True
wsgi.multithread = False
wsgi.run_once = False
wsgi.url_scheme = 'https'
wsgi.version = '(1, 0)'
Settings:
Using settings module config.settings.dev
ABSOLUTE_URL_OVERRIDES = {}
ACCOUNT_ACTIVATION_DAYS = 7
ADMIN_MEDIA_PREFIX = '/static/admin/'
ALLOWED_HOSTS = ['*']
APPEND_SLASH = True
AUTHENTICATION_BACKENDS = "('accounts.backends.default.AuthBackend', 'django.contrib.auth.backends.ModelBackend')"
AUTH_USER_MODEL = 'auth.User'
AWS_DEFAULT_ACL = 'authenticated-read'
AWS_QUERYSTRING_EXPIRE = 30
AWS_S3_ENCRYPTION = True
AWS_SES_AUTO_THROTTLE = 0.5
AWS_SES_RETURN_PATH = 'Myapp <[email protected]>'
AWS_STORAGE_BUCKET_NAME = 'myapp-dev'
BASE_DIR = '/usr/src/app'
BASE_SITE_ID = 3
BROKER_CONNECTION_RETRY_ON_STARTUP = True
BROKER_URL = 'redis://:<REDIS_PASS>@redis:6379/0'
CACHES = {'default': {'BACKEND': 'redis_cache.RedisCache', 'LOCATION': 'redis://:<REDIS_PASS>@redis:6379', 'OPTIONS': {'DB': 3}}}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_URL = 'redis://:<REDIS_PASS>@redis:6379'
CELERYBEAT_SCHEDULE = {'daily-subscription-check': {'task': 'companies.tasks.subscription_check', 'schedule': <crontab: 0 2 * * * (m/h/dM/MY/d)>}, 'send-campaign-emails': {'task': 'emails.tasks.task_check_campaign_emails', 'schedule': <crontab: 1 * * * * (m/h/dM/MY/d)>}}
CELERY_ACCEPT_CONTENT = ['json']
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True
CELERY_BROKER_URL = 'redis://:<REDIS_PASS>@redis:6379/0'
CELERY_RESULT_BACKEND = 'redis://:<REDIS_PASS>@redis:6379/1'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
COMPRESS_CACHEABLE_PRECOMPILERS = '()'
COMPRESS_CACHE_BACKEND = 'default'
COMPRESS_CACHE_KEY_FUNCTION = '********************'
COMPRESS_CLEAN_CSS_ARGUMENTS = ''
COMPRESS_CLEAN_CSS_BINARY = 'cleancss'
COMPRESS_CLOSURE_COMPILER_ARGUMENTS = ''
COMPRESS_CLOSURE_COMPILER_BINARY = 'java -jar compiler.jar'
COMPRESS_CSS_COMPRESSOR = 'compressor.css.CssCompressor'
COMPRESS_CSS_FILTERS = ['compressor.filters.css_default.CssAbsoluteFilter']
COMPRESS_CSS_HASHING_METHOD = 'mtime'
COMPRESS_DATA_URI_MAX_SIZE = 1024
COMPRESS_DEBUG_TOGGLE = None
COMPRESS_ENABLED = False
COMPRESS_JINJA2_GET_ENVIRONMENT = <function CompressorConf.JINJA2_GET_ENVIRONMENT at 0x7cc3c1ed9550>
COMPRESS_JS_COMPRESSOR = 'compressor.js.JsCompressor'
COMPRESS_JS_FILTERS = ['compressor.filters.jsmin.JSMinFilter']
COMPRESS_MINT_DELAY = 30
COMPRESS_MTIME_DELAY = 10
COMPRESS_OFFLINE = False
COMPRESS_OFFLINE_CONTEXT = {'STATIC_URL': '/static/'}
COMPRESS_OFFLINE_MANIFEST = 'manifest.json'
COMPRESS_OFFLINE_TIMEOUT = 31536000
COMPRESS_OUTPUT_DIR = 'CACHE'
COMPRESS_PARSER = 'compressor.parser.AutoSelectParser'
COMPRESS_PRECOMPILERS = '()'
COMPRESS_REBUILD_TIMEOUT = 2592000
COMPRESS_ROOT = '/var/www/myapp/static'
COMPRESS_STORAGE = 'compressor.storage.CompressorFileStorage'
COMPRESS_TEMPLATE_FILTER_CONTEXT = {'STATIC_URL': '/static/'}
COMPRESS_URL = '/static/'
COMPRESS_VERBOSE = False
COMPRESS_YUGLIFY_BINARY = 'yuglify'
COMPRESS_YUGLIFY_CSS_ARGUMENTS = '--terminal'
COMPRESS_YUGLIFY_JS_ARGUMENTS = '--terminal'
COMPRESS_YUI_BINARY = 'java -jar yuicompressor.jar'
COMPRESS_YUI_CSS_ARGUMENTS = ''
COMPRESS_YUI_JS_ARGUMENTS = ''
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SAMESITE = 'Lax'
CSRF_COOKIE_SECURE = True
CSRF_FAILURE_VIEW = 'users.views.csrf_failure'
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
CSRF_USE_SESSIONS = False
DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'myapp', 'USER': 'myapp_dev_user', 'PASSWORD': '********************', 'HOST': '172.17.0.1', 'PORT': '5432', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'NAME': None, 'MIRROR': None}}}
DATABASE_ROUTERS = []
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = 'N j, Y, P'
DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y']
DATE_FORMAT = 'N j, Y'
DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']
DEBUG = True
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = '.'
DEFAULT_CHARSET = 'utf-8'
DEFAULT_CONTENT_TYPE = 'text/html'
DEFAULT_DOMAIN_NAME = 'myapp.com'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
DEFAULT_FROM_EMAIL = 'Myapp <[email protected]>'
DEFAULT_INDEX_TABLESPACE = ''
DEFAULT_TABLESPACE = ''
DISALLOWED_USER_AGENTS = []
DJANGO_APPS = ['django.contrib.contenttypes', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.redirects', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.flatpages']
DJANGO_ENV = 'development'
DJANGO_ROOT = '/usr/local/lib/python3.8/site-packages/django'
DKIM_DOMAIN = 'myapp.com'
EMAIL_BACKEND = 'django_ses.SESBackend'
EMAIL_HOST = 'redis://:<REDIS_PASS>@redis:6379/0'
EMAIL_HOST_PASSWORD = '********************'
EMAIL_HOST_USER = ''
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = '********************'
EMAIL_SUBJECT_PREFIX = '[Django] '
EMAIL_TIMEOUT = None
EMAIL_USE_LOCALTIME = False
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
ENVIRONMENT = 'development'
FILE_CHARSET = 'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = []
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS = []
INSTALLED_APPS = ['django.contrib.contenttypes', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.redirects', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.flatpages', 'ajax_form', 'compressor', 'django_ses', 'djrill', 'restless', 'storages', 'sorl.thumbnail', 'unfriendly', 'widget_tweaks', 'rest_framework', 'rest_framework.authtoken', 'accounts', 'administrators', 'clients', 'comments', 'companies', 'creditcard', 'documents', 'emails', 'esign', 'facades', 'tabs', 'merchants', 'pfsgen', 'professionals', 'rest_auth', 'svcore', 'users', 'debug_toolbar', 'sslserver']
INTERNAL_IPS = []
LANGUAGE_CODE = 'en-us'
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_NAME = 'django_language'
LANGUAGE_COOKIE_PATH = '/'
LOCALE_PATHS = []
LOGGING = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'standard': {'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'}}, 'handlers': {'console': {'class': 'logging.StreamHandler'}}, 'loggers': {'django.db': {'handlers': ['console'], 'level': 'ERROR', 'propagate': False}, 'django.template': {'handlers': ['console'], 'level': 'INFO', 'propagate': False}, 'django': {'handlers': ['console'], 'level': 'INFO', 'propagate': True}, 'myapp': {'handlers': ['console'], 'level': 'DEBUG', 'propagate': False}}}
LOGGING_CONFIG = 'logging.config.dictConfig'
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/login/'
LOGOUT_REDIRECT_URL = None
MEDIA_ROOT = ''
MEDIA_URL = ''
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE = ['django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.sites.middleware.CurrentSiteMiddleware', 'svcore.middleware.MultiSiteMiddleware', 'svcore.middleware.CheckAccessLevelMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.redirects.middleware.RedirectFallbackMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware']
MIGRATION_MODULES = {'sites': 'svcore.sites_migrations'}
MONTH_DAY_FORMAT = 'F j'
NUMBER_GROUPING = 0
PASSWORD_HASHERS = '********************'
PASSWORD_RESET_TIMEOUT_DAYS = '********************'
PREPEND_WWW = False
PROJECT_NAME = 'Myapp'
PROJECT_SLUG = 'myapp'
REDIS_BROKER_URL = 'redis://:<REDIS_PASS>@redis:6379/0'
REDIS_HOST = 'redis'
REDIS_PASSWORD = '********************'
REDIS_PORT = '6379'
REDIS_RESULT_BACKEND = 'redis://:<REDIS_PASS>@redis:6379/1'
REDIS_URL = 'redis://:<REDIS_PASS>@redis:6379'
REGISTRATION_BACKEND = 'accounts.backends.default.DefaultBackend'
REGISTRATION_OPEN = True
REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication')}
RESULT_BACKEND = 'redis://:<REDIS_PASS>@redis:6379/1'
ROOT_URLCONF = 'config.urls.dev'
SECRET_KEY = '********************'
SECURE_BROWSER_XSS_FILTER = False
SECURE_CONTENT_TYPE_NOSNIFF = False
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_HSTS_PRELOAD = False
SECURE_HSTS_SECONDS = 0
SECURE_PROXY_SSL_HEADER = None
SECURE_REDIRECT_EXEMPT = []
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = False
SERVER_EMAIL = '[email protected]'
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_AGE = 1209600
SESSION_COOKIE_DOMAIN = '.myapp.com'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = 'myapplocalhost'
SESSION_COOKIE_PATH = '/'
SESSION_COOKIE_SAMESITE = 'Lax'
SESSION_COOKIE_SECURE = True
SESSION_ENGINE = 'redis_sessions.session'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_FILE_PATH = None
SESSION_REDIS_DB = 2
SESSION_REDIS_HOST = 'redis'
SESSION_REDIS_PASSWORD = '********************'
SESSION_REDIS_PORT = '6379'
SESSION_REDIS_PREFIX = 'session'
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'config.settings.dev'
SHORT_DATETIME_FORMAT = 'm/d/Y P'
SHORT_DATE_FORMAT = 'm/d/Y'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = []
SITE_ID = 3
STATICFILES_DIRS = []
STATICFILES_FINDERS = "('django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder')"
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = '/var/www/myapp/static/'
STATIC_URL = '/static/'
MYAPP_APPS = ['accounts', 'administrators', 'clients', 'comments', 'companies', 'creditcard', 'documents', 'emails', 'esign', 'facades', 'tabs', 'merchants', 'pfsgen', 'professionals', 'rest_auth', 'svcore', 'users']
MYAPP_COMPANY_ID = 1
MYAPP_ROOT = '/usr/src/app/vault'
SUBSCRIPTION_EXCLUDE_LIST = [1]
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_DIRS': True, 'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'django.template.context_processors.media', 'django.template.context_processors.request', 'django.template.context_processors.static', 'svcore.context_processors.debug', 'svcore.context_processors.notifications'], 'debug': True}}]
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
THIRD_PARTY_APPS = ['ajax_form', 'compressor', 'django_ses', 'djrill', 'restless', 'storages', 'sorl.thumbnail', 'unfriendly', 'widget_tweaks', 'rest_framework', 'rest_framework.authtoken']
THOUSAND_SEPARATOR = ','
TIME_FORMAT = 'P'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE = 'America/New_York'
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = False
USE_TZ = False
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WSGI_APPLICATION = None
X_FRAME_OPTIONS = 'SAMEORIGIN'
YEAR_MONTH_FORMAT = 'F Y'
You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.
'
at Object.<anonymous> (djangoAuth.js:45:33)
at angular.js:1256:18
at angular.js:11264:13
at processQueue (angular.js:15961:28)
at angular.js:15977:27
at Scope.$eval (angular.js:17229:28)
at Scope.$digest (angular.js:17045:31)
at Scope.$apply (angular.js:17337:24)
at done (angular.js:11572:47)
at completeRequest (angular.js:11778:7)
Here’s the log from Docker Compose, all the services start correctly and the app is exposed to myapp.com where I can access it. The only thing that doesn’t seem right is that Redis logs Failed to write PID file: Permission denied
. Running systemctl shows that redis-server.service is loaded but failed, but Redis should be running as a Docker container anyway.
redis-1 | 1:C 15 Jul 2024 23:34:07.651 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-1 | 1:C 15 Jul 2024 23:34:07.651 * Redis version=7.2.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis-1 | 1:C 15 Jul 2024 23:34:07.651 * Configuration loaded
redis-1 | 1:M 15 Jul 2024 23:34:07.653 * monotonic clock: POSIX clock_gettime
redis-1 | 1:M 15 Jul 2024 23:34:07.655 # Failed to write PID file: Permission denied
redis-1 | 1:M 15 Jul 2024 23:34:07.655 * Running mode=standalone, port=6379.
redis-1 | 1:M 15 Jul 2024 23:34:07.659 * Server initialized
redis-1 | 1:M 15 Jul 2024 23:34:07.659 * Ready to accept connections tcp
django-1 | [uWSGI] getting INI configuration from /usr/src/app/vault/config/uwsgi.ini
nginx-1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
nginx-1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
nginx-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
nginx-1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
nginx-1 | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
nginx-1 | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
nginx-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
nginx-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
nginx-1 | /docker-entrypoint.sh: Configuration complete; ready for start up
celery_worker-1 |
celery_worker-1 | -------------- celery@3cd9b8201a11 v5.3.0 (emerald-rush)
celery_worker-1 | --- ***** -----
celery_worker-1 | -- ******* ---- Linux-6.8.0-1010-aws-x86_64-with-glibc2.34 2024-07-15 19:34:14
celery_worker-1 | - *** --- * ---
celery_worker-1 | - ** ---------- [config]
celery_worker-1 | - ** ---------- .> app: myapp:0x7dfcd9656430
celery_worker-1 | - ** ---------- .> transport: redis://:**@redis:6379/0
celery_worker-1 | - ** ---------- .> results: redis://:**@redis:6379/1
celery_worker-1 | - *** --- * --- .> concurrency: 10 (prefork)
celery_worker-1 | -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
celery_worker-1 | --- ***** -----
celery_worker-1 | -------------- [queues]
celery_worker-1 | .> celery exchange=celery(direct) key=celery
celery_worker-1 |
celery_worker-1 |
celery_worker-1 | [tasks]
celery_worker-1 | . companies.tasks.subscription_check
celery_worker-1 | . emails.tasks.task_check_campaign_emails
celery_worker-1 | . emails.tasks.task_send_email
celery_worker-1 | . esign.tasks.task_draw_layers
celery_worker-1 | . myapp.celery.debug_task
celery_worker-1 |
celery_beat-1 | [2024-07-15 19:34:14,931: INFO/MainProcess] beat: Starting...
celery_worker-1 | [2024-07-15 19:34:15,983: INFO/MainProcess] mingle: searching for neighbors
celery_worker-1 | [2024-07-15 19:34:16,998: INFO/MainProcess] mingle: all alone
celery_worker-1 | [2024-07-15 19:34:17,033: INFO/MainProcess] celery@3cd9b8201a11 ready.
Kristian Kolehmainen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.