user15835249
user15835249

Reputation:

How to run Python Flask app on domain name?

I own a domain name, how can I get my flask app to run on it, using my public IP address (assigned to me by my internet provider)? I don't want it to run on localhost, or my private IPv4 address, I want it to run on my Public IP address. Thanks in advance.

If it helps, I am using Google Domains.

Do I need to add anything to my flask app?

I'm currently running it like this:

if __name__ == "__main__":
  db.create_all()
  app.run(debug=True, host="0.0.0.0", port=80)

Upvotes: 1

Views: 2170

Answers (1)

Tim Roberts
Tim Roberts

Reputation: 54787

Was this a public IP provided by your Internet provider? Or is it a public IP provided by a web hosting company? The two answers are different.

If it came from a web hosting company, then you need to upload your flask app to your account on their server. Note, however, that most shared hosting companies will not let you run an app 24/7. They want to support FastCGI servers that come and go.

If this was provided by your Internet provider, then you will need to provide and configure a server. You will need to have your router redirect port 80 and 443 to that server. You will then need to run your flask app on that server. Make sure your server is secure, because public-facing IP address get hammered by scammers.

Upvotes: 1

Related Questions