Bobcares

An easy way to setup Python App in cPanel server

by | Feb 2, 2019

My client wants to host Django application on the shared hosting server. Can you setup python app on cPanel so that I can host the website?

That was a recent customer request received in our Server Administration Services for Web Hosting providers.

Enabling Python support requires few configuration changes at the server side. Today, we’ll see how our Dedicated Engineers setup Python App on Cpanel server for the customer.

Additionally, we’ll take a look at the common problems in Python App setup and how we fix them.

Server requirements

Python is an ideal language for web app development because it’s quick to write. It has built-in support for things like web server and database integration.

Unlike normal applications, for hosting Python apps, server should fulfill couple of requirements. We’ll now see the list of them.

Web Hosting providers planning to offer Python Hosting, the server should be really robust. It should have enough memory to process Python process. Again, this depends on the number of Python websites and the type of application too.

Our Dedicated Engineers study the requirement and suggest the recommended server hardware configuration to customer. Further, we need to setup the proper version of Python on the server.

Similarly, Python hosting requires support for frameworks such as Flask and Django. Also, the server should support additional Python modules.

Again, if there are complex apps that run lengthy Python processes, the server should be able to run persistent processes.

 

How to enable Python App in cPanel

We now know the benefits and requirements to host Python apps on the server.

But, how can we implement this?

One of the easiest ways is to use “Setup Python App” option included as part of the Python Selector feature in CloudLinux.

Here, the customer was having a plain CentOS cPanel server. Let’s see how our Support Engineers prepared it for Python Hosting.

1. Install CloudLinux

Firstly, we checked and confirmed the accounts on the server and prepared the server for installing CloudLinux. CloudLinux installation involves paid license. So, we suggested customer on the right license to purchase from CloudLinux team.

Meanwhile, we scheduled the installation in off peak hours, so that downtime do not affect the business. And, when the customer came back with the new License, our Dedicated Engineers set up CloudLinux on the server.

 

2. Enable Python App from WHM

Upon installing CloudLinux, Python lists as a module in the CloudLinux LVE Manager

As the next step, we enabled Python. The snapshot of the CloudLinux LVE Manager shows Python enabled.

The server now can host Python applications.

 

3. Install Python App on website

To start building Python app in your website, it has to enabled in each website. For this, we login to the cPanel of the website. And, enable Python App from the Software section as shown in picture.

Hurray! You’re all set to start building Python web app.

 

Common errors with Python App

Though, the installation is fairly straightforward, we often see customer stumbling upon problems with Python apps. Let’s now take a quick look on the common problems with setup.

 

1. Permission problems with scripts

Recently, a customer reported problems with his Python scripts generating “500 Internal server error”.

On checking, we found that the server was having proper Python version, and correct handlers to execute Python scripts. Debugging further, our Support Engineers found that the scripts were having wrong permissions.

To fix, we changed the permissions of scripts to 0755 and they started working fine.

 

2. Missing dependency modules

Similarly, a common reason for Python problems is missing related modules. One such error is

ImportError: No module named flask

Here, the server was not having the flask module. To fix, our Dedicated Engineers installed flask module and that fixed the problem.

[Finding problems with Python scripts? We can fix your Python app and make it working.]

Conclusion

In short, one of the best methods to start Python hosting in cPanel servers is to setup Python App. Today, we saw how our Dedicated Engineers setup Python App in cPanel server for one of our customers and fix common errors with it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.