[Errno 111] Connection refused ERROR

I'm having a [Errno 111] Connection refused error and i'm not sure what to do... I'm following this tutorial here. Please Help, Thanks!

Hi everyone

In advance, I ask for excuses for my writing. English is not my language.

l also have the same issue. And reading a bit, I've found that possibly the origin of this is due to pythonanywhere doesn't have the mysql database connector. If you look for the prerequisites of the package mysqlclient (a python package to connect with the database) it says it needs python3-dev, in case your using python3. "python3-dev" is the mysql database connector fork of the MySQLdb but with python support. Such package isn't listed in the "included batteries" (the list of packages this platform counts with).

The only way to install that package is to count with administrator rights because you need to run apt-get install for that. Therefore, the only remaining solution I find is to ask the administrator to install such package for us.

@PythonTester -- it sounds like you're trying to connect to an external site without using the proxy that is required by free accounts. Could you give a little more detail about exactly what you're trying to connect to?

@GrupoApoyoDavid -- I think you're a bit confused; the MySQL database connector is already installed. You can also install it yourself (into a virtualenv, for example) by using these instructions. python3-dev is an Ubuntu/Debian package, and it is also already installed.

Hi @giles Thanks for your reply. You are right. I am trying to connect to an external MySQL database. About the details your asking me for, what do you need me to tell you? In summary, it's a Django project configured to connect to a MySQL database hosted in a GoDaddy domain (I guess). The point is that I worked that project locally and have no problem connecting with the database and everything is ok. But, when I upload the project to pythonanywhere I got an 111 MySQL failure code and my app doesn't function. You said something about a proxy that is required for free accounts. Could you give me more info about? I didn't know about that! Greetings

I'm trying to send and password reset email and every time I go to this link and add an email , I get an error message. You can input this email: '' to see the error.

@GrupoApoyoDavid -- unfortunately you won't be able to connect to an external MySQL database from a free account -- we only allow HTTP and HTTPS connections to a set of whitelisted servers; your MySQL DB won't be on the whitelist (we only add official public APIs), and the connection your code will try to create will use the MySQL protocol rather than HTTP or HTTPS. Paid accounts have unrestricted Internet access, so it will work if you upgrade your account.

@PythonTester -- which SMTP server are you trying to connect to? One exception to the HTTP(S)/whitelist rule I mentioned in my comment above is that we do allow connections to the gmail SMTP server. If you're using any other SMTP server, then it won't work.

One alternative to Gmail is to use a service that allows you to send email using an HTTP(S) API -- both Mailgun and Sendgrid are on the whitelist.