Question

port 25060 failed: Operation timed out

Whenever I try to make Django migrations I get this error below what is causing it? I can run makemigrations successfully, and now django migrate command. Also, ever since I connected to Django app, database and buckets, I can no longer run the Django server locally on my computer.

django.db.utils.OperationalError: connection to server at “app-ffb0c792-66af-4849-9524-05a756f81199-do-user-14954907-0.c.db.ondigitalocean.com” (64.23.139.202), port 25060 failed: Operation timed out Is the server running on that host and accepting TCP/IP connections?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 24, 2024

Hello Chris,

The issue you’re encountering with your Django application’s connection to the DigitalOcean managed database is likely related to the configuration of trusted sources in DigitalOcean. This is a common setup detail that can lead to the type of timeout error you’re experiencing. Here’s how you can address it:

  1. Check the Trusted Sources Setting:

    • In DigitalOcean’s managed database settings, there’s an option to specify trusted sources — these are the IP addresses or resources that are allowed to connect to your database.
    • If your local environment’s IP address or your app name is not listed as a trusted source, DigitalOcean will block attempts to connect to the database.
  2. Add Your IP to Trusted Sources:

    • Log in to your DigitalOcean control panel.
    • Navigate to the “Databases” section and select your database.
    • Look for the “Settings” or “Security” tab where you can manage trusted sources.
    • Add your current IP address to the list of trusted sources. If you’re working in a dynamic IP environment (like a home internet connection), you may need to update this regularly: https://ifconfig.io
  3. Consider Connection Pooling:

    • If your application is hosted on the DigitalOcean App Platform and you’re also using a DigitalOcean managed database, ensure that your app is correctly configured to use the database.
    • Sometimes, using a connection pool (if supported by your setup) can help manage database connections more efficiently.

By ensuring your local environment and application are listed as trusted sources in your DigitalOcean database settings, you should be able to resolve the connection timeout issue.

Let me know how it goes!

Best,

Bobby

KFSys
Site Moderator
Site Moderator badge
January 21, 2024

Heya @chrismlalazi,

That’s really weird, can you please make sure you’ve followed the directions here to the letter :

https://docs.digitalocean.com/developer-center/deploy-a-django-app-on-app-platform/

See if there is anything you missed.

As for the local environment, it shouldn’t be in anyway related to your Djago App Platform can you confirm how exactly is it not working.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel