How to define flask SERVER_NAME correctly for deployment

Viewed 427

My flask website used to work correctly until I had to define a subdomain with flask.

For the subdomain to work, the (SERVER_NAME) should be configured and point to the host address (mywebsite1.com) instead of IP.

This worked with me correctly on the local machine, however after deployment to an azure host following error keeps printing, and the website not working:

self.socket.bind(self.server_address)
OSError: [Errno 99] Cannot assign requested address

I tried to define the SERVER_NAME in different ports and it did not work after deployment:

app.config['SERVER_NAME'] = 'mywebsite1.com:80'

and

app.config['SERVER_NAME'] = 'mywebsite1.com:5000'

The only way my website working is when defining the localhost this way, but subdomains not detected and always point to the homepage:

app.config['SERVER_NAME'] = '0.0.0.0:5000'

Please help to define SERVER_NAME that works on Azure host and docker.

0 Answers
Related