How to View Errors on a Python/NodeJS App in cPanel

Sometimes, after deploying your Python/NodeJS app in cPanel, you may get an error 500. Unfortunately, error 500 does not tell you much about whats affecting your site. This is a generic error message.

You can however view the actual error behind this cryptic error 500 from your cPanel.

There are two ways to do this:

  • Use error log created by your app
  • Enable error display on the site via .htaccess

Use error log created by your app

1.Login to your cPanel and go to File Manager

2.Navigate to the folder where your python files are.

3.Look for a file called stderr.log

4.Open the file and view the Errors displayed. In my example, I got a ModuleErrorLog due to some missing modules in my app

Enable error display on the site via .htaccess

To enable errors, follow these steps:

1.Login to cPanel and go to File Manager

2.Open your document root and find the .htaccess file.

Note: For the main domain in cPanel, document root is usually public_html. Addons and subdomains may have different document roots. By default though, the document root of an Addon Domain is a folder whose name is the same as the addon domain. Same applies for sub domains

3.Open the .htaccess file and add the following line

PassengerAppEnv "development"

4. Save the changes and restart your Python/NodeJS App

5. When you access your site, detailed pages like the one below will be displayed. From the errors displayed, you can fix the app

Was this article helpful?

Related Articles

Leave A Comment?