Flask was created by Armin Ronacher of Pocoo which is an international group of Python enthusiasts formed in 2004. Flask is a lightweight Python web framework based on Werkzeug and Jinja 2, Flask tackles Routing, HTML template rendering, Sessions etc. If you are building web applications on Linux, then I highly recommend using Flask.
Flask is an extremely functional and powerful framework that is most popular and very much extensible with a great choice of third party libraries.
Flask is called a micro framework because it does not presume or force a developer to use a particular tool or library. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself.
The Gunicorn also known as "Green Unicorn" is a Python Web Server Gateway Interface (WSGI) HTTP server. It is a pre-fork worker model, ported from Ruby's Unicorn project.
The Gunicorn server is broadly compatible with a number of web frameworks, simply implemented, light on server resources and fairly fast.
Flask was designed to be easy to use and extend. Flask is great for all kinds of projects. It's especially good for prototyping. Flask depends on two external libraries: the Jinja2 template engine and the Werkzeug WSGI toolkit.
Despite the lack of a major release, Flask has become extremely popular among Python enthusiasts. Flask provides several very useful features, some of them are listed below.
Flask has a lightweight and modular design, so it easy to transform it to the web framework you need with a few extensions without weighing it down
HTTP request handling functionality and High Flexibility
Support for secure cookies (client side sessions) and Integrated support for unit testing
Built-in development server and fast debugger
Flask documentation are comprehensive, full of examples and well structured. You can even try out some sample application to really get a feel of Flask.
Jinja2 templating and WSGI 1.0 compliant
In this tutorial, we will learn how to set up the Gunicorn application server to launch the application and Nginx to act as a front end reverse proxy.
A server running Ubuntu-14.04.
A static IP Address for your server.
A non-root user account with sudo privilege set up on your server.
Nginx is a free, open-source, high-performance HTTP server and reverse proxy server, also known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
It has reached its popularity due to being light weight, relatively easy to work with and easy to extend with add-ons and plug-ins.
Before starting, update the system by running the following commands:
sudo apt-get updatesudo apt-get upgrade
Then, install Nginx by running the following command:
sudo apt-get install nginx
Next, start Nginx service by running the following command:
sudo /etc/init.d/nginx start
Then, add Nginx service to start at boot time by running the following command:
You can test Nginx configuration by running the following command:
sudo nginx -t
You will see the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Now, start Nginx service by running the following command:
sudo /etc/init.d/nginx start
Congrats!.. You should now able to see your application by running the following curl command:
You should see the following output:
This is sample Flask App
In this tutorial, you have learned to create a Flask application within a Python virtual environment, create WSGI entry point, configure the Gunicorn app server to provide this function and created an Nginx server block that passes web client traffic to the application server.
You can also design your own app and serve the flask applications.
You can create an email email filters through your cPanel control panel which is where you manage your hosting account. Email filters can be set up to target specific word, subject, from or to. Emails that are filtered out can be sent to a different email, deleted, delivered to a...
If you find your cPanel disk space filling up, or an email address has hit its disk space quota, cPanel has a helpful built in Email Disk Usage tool. This will provide you with a simple to understand breakdown of how much disk space each folder for a particular email...
Although WHM will normally automatically keep itself up to date, you may want to manually check for server updates / push through an update that is pending, or it may be that you have automatic updates switched off on your cPanel server. In this guide we will show you how...