Report this

What is the reason for this report?

port 25060 failed: Operation timed out

Posted on January 21, 2024

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?



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!

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.

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.