How to setup Python (Flask) with Application Manager

Requirements

Install python package as per version required. Also install passenger application from Webuzo Admin Panel.

In case Python or passenger is not installed please ask your server admin to install it from  Webuzo Admin Panel > Apps > Install App

Clone the python project

Go to user home directory where you have to clone the repository. You can clone the repository from the below command  as a user.

git clone https://github.com/phusion/passenger-python-flask-demo.git

Note : You can also clone the repository from  Webuzo Enduser Panel > Server Utilities > Git TM Version Control

Setup Python (Flask) application to run with passenger

If Flask is not installed you can install it with pip binary given in the add application wizard as below.

/usr/local/apps/python3/bin/pip3 install flask

The Passenger WSGI file

Create a WSGI file in the app's directory. Passenger expects it be called passenger_wsgi.py. The contents depends on the application and the web framework, but for our Flask example app, this is what you need to put in the file:

# passenger_wsgi.py
from app import MyApp as application

To add python application go to Webuzo Enduser Panel > Applications > Add Applications > Passenger Tab

Note : Before adding the application change the port in your project as given in "Add application" wizard.

For example in this application change "MyApp.run()" to "MyApp.run(host='0.0.0.0', port=30001, debug=True)" in manage.py

Fill the required fields, select python from "Application type" drop down and save it.

image

After saving it will be show in "List Applications" wizard.

image

After the adding application check the domain in browser

image
Was this page helpful?