Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Flask server add another port to domain

Initial Condition: I have a Python Flask server running on a remote machine that I am accessing via Linux(OpenSuse) command line. The server works perfect. It renders the html for xyz.com:5000.

Problem: I am a new user added. I want the server to read my .py files. What do I do? Do I need a new port number? Or will it be xyz.myusername.com:5000? What configurations do I have to change? Does the superuser need to intervene?

Thanks!

like image 458
Struggler Avatar asked Jan 29 '13 00:01

Struggler


People also ask

How do you run a flask application on two different ports simultaneously?

Run multiple servers simultaneously Create another Flask server script that runs on another port, for example port 4001. Then open two separate terminals and run both scripts. You will see something like this: Both servers are now running locally, each with their own port.


1 Answers

Flask's built-in server is not intended for production use - or at least, the documentation refers to it as a "local development server".

For production, something like Tornado, gunicorn, or even Apache is what you'll need to be using.

See also: Flask documentation covering the Flask.run() method.

That said - it's just a Python program. There's no reason you couldn't run your own on a different port via app.run(port=5001).

like image 188
Lyndsy Simon Avatar answered Sep 21 '22 06:09

Lyndsy Simon