Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Django Watchtower connection refused when running server localhost

I am using Django watchtower to log events to Cloudwatch and have configured my logging in my settings file.

development.py

boto3_session = Session(
    aws_access_key_id=AWS_ACCESS_KEY_ID,
    aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
    region_name=AWS_REGION)


LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    # 'root': {
    #     'level': 'INFO',
    #     'handlers': ['console'],
    # },
    'formatters': {
        'simple': {
            'format': "%(asctime)s [%(levelname)-8s] %(message)s",
            'datefmt': "%Y-%m-%d %H:%M:%S"
        },
        'aws': {
            # you can add specific format for aws here
            'format': "%(asctime)s [%(levelname)-8s] %(message)s",
            'datefmt': "%Y-%m-%d %H:%M:%S"
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
        'watchtower': {
            'level': 'INFO',
            'class': 'watchtower.CloudWatchLogHandler',
            'boto3_session': boto3_session,
            'log_group': 'StagingBeagleApi',
            'stream_name': 'ApplicationLogStream',
            'formatter': 'aws',
        },
    },
    'loggers': {
        'django': {
            'level': 'INFO',
            'handlers': ['watchtower'],
            'propagate': True,
        },
    },
}

However when I run my server, I don't get any error in the console but my site is not accessible anymore via locahost:3000, I get an ERR_CONNECTION_REFUSED

Please help!

UPDATE

If I replace the django key with watchtower it works. However, I want to put all Django logs into Cloudwatch and I followed the documentation which has the logger key as django.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can pass another value beside the array ['watchtower'], which may resolve the issue. You can check the below code as a sample.

'loggers': { 'django': { 'level': 'INFO', 'handlers': ['watchtower','django'], 'propagate': True, }, },

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!