Deploying Flask application

As part of my activity with a modeller group near home, I maintain the site of the group (www.footy.it, italian only) and someone suggested that it should be nice to have a list of yacht that we own/use. So flotta.footy.it was born.\n

The site itself is a very simple interface to search for someone that has a footy yacht near you, but it is not this the point of the article. It is developed using the Flask python micro framework and mongodb database.

After some weeks of working in the free time, I come up with a pretty decent site, at least for what it need to do, and I have the problem to deploy it, using nginx as webserver. After a bit of research, I fount that a simple way to deploy the site was to use this configuration:

#
# Flask application
#
server {
          listen       80;
          server_name  [your_site];
          location / {
            proxy_pass http://127.0.0.1:5000;
            proxy_set_header Host $proxy_host;
            proxy_set_header  X-Real-IP  $remote_addr;
          }
}

which basically say to forward all the request on the port 80 for [your_site] to the proxy_pass address, where the flask application is running.
After that, I just needed to start the application and test the site. The application was started using the nohup command, but I suppose there are some better ways to do it but I will think at this another time (for now the site is in the testing phase).

Update: the site is no longer active, but the the instruction still stand ;-)