ClarkeFL
ClarkeFL

Reputation: 129

Receiving 503 server busy error code when setting up python on cpanel

Please note that if I could find any other answer I would have not posted this question!

I'm currently in a difficult situation. On Cpanel there is a service called "Setup Python App" I followed multiple online tutorials on setting up. When setting one up it generates an automatic passenger_wsgi.py file which points to the mainapp.py generated file and runs the code in there which is below:

passenger_wsgi.py

import imp
import os
import sys


sys.path.insert(0, os.path.dirname(__file__))

wsgi = imp.load_source('wsgi', 'mainapp.py')
application = wsgi.mainapp

mainapp.py

import os
import sys


sys.path.insert(0, os.path.dirname(__file__))


def mainapp(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    message = 'It works!\n'
    version = 'Python v' + sys.version.split()[0] + '\n'
    response = '\n'.join([message, version])
    return [response.encode()]

When trying to load the URL it fails with a 503 error. I've tried searching for log files that show any error. but no errors pop up.

I saw that lightspeed could cause an issue. But not sure if that is the case. I have access to WHM if there is something I'm missing.

Hope someone can help.

Upvotes: 1

Views: 1288

Answers (1)

ClarkeFL
ClarkeFL

Reputation: 129

Found the issue. The server was missing the lsapi-wsgi package for the python application to work with lsapi.

Just installed that and the project worked.

Upvotes: 1

Related Questions