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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF