How to structure and deploy an Angular2 app with a Flask back-end api while using Nginx and Gunicorn.

Posted December 26, 2016 14.5k views
NginxPython FrameworksDeploymentUbuntu 16.04

I’m having a Linux based Droplet(Ubuntu 16.04). I need to know the application structure to follow. Also, where should the Nginx root point to; and if possible the custom server block config for the Nginx server.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

I would recommend starting with this guide to deploy your flask API.

With your Angular2 app running on the same droplet you should be able to add a second Location block in your nginx configuration using proxypass to pass through communications to angular. This guide provides some examples of nginx proxypass configuration for another service running on it’s own port on the same droplet.

by Justin Ellingwood
In this guide, we will be setting up a simple Python application using the Flask micro-framework on Ubuntu 16.04. The bulk of this article will be about how to set up the Gunicorn application server to launch the application and Nginx to act as a front end reverse...