Flask project in Visual Studio 2015: how to specify a port number?

How can I specify the port number in a pask project in Flask in Visual Studio 2015, so when it starts it always uses the same port?

My boot file (app.py) is as follows:

from svc.svc import app wsgi_app = app.wsgi_app if __name__ == '__main__': import os HOST = os.environ.get('SERVER_HOST', 'localhost') try: PORT = int(os.environ.get('SERVER_PORT', '5555')) except ValueError: PORT = 5555 app.run(HOST, PORT) 

Therefore, I assume that I need to specify the SERVER_PORT environment variable for the debugger process, but I cannot find any option for it.

+5
source share
1 answer

In Visual Studio, right-click the project name and select Properties. Then click “Debug” and you will see the “Port Number” and “Environment” sections, in which you can set the port number and any other environment variables.

Port Number and Environment Variables

+8
source

All Articles