Is ASGI django app supported in cpanel?

JasmineXU

Registered
Aug 22, 2020
4
0
1
uk
cPanel Access Level
Website Owner
Hi,

I have an asgi django app, and I have access to cpanel.
I am wondering if cpanel support asgi app (not wsgi).
I have been searching around and have seen a lot of tutorial of deployment of wsgi app, but no luck for asgi app.
If asgi is supported, could you please guide me how to deploy it?

Thanks in advance.
 

JasmineXU

Registered
Aug 22, 2020
4
0
1
uk
cPanel Access Level
Website Owner
At this moment, I have set up somethings (created a python app, copied my project to cpanel), though not sure I have set correctly. I try to test it with production server in port 8000, which is not responding. I tried some commands like netstat, telnet, but I got errors command not found. Any ideas how to solve it?

Another question: when I create a python app, it gives passenger_wsgi.py. Am I supposed to do something with it to have asgi app setup?
 
Last edited:

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,262
313
Houston
Hi @JasmineXU

Could you possibly provide an example app? From what I understand after discussing this internally is that this should work if you initiate it with app.py but we'd like to test it to confirm this.

Thanks!
 

JasmineXU

Registered
Aug 22, 2020
4
0
1
uk
cPanel Access Level
Website Owner
Hi,

My app is using Otree which is based on django.
Here are the demo apps in github:
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,262
313
Houston
Hi @JasmineXU

Looking at this, it says it requires Python 3.7 and the version of Python we use is what is distributed by the OS on CentOS 7 this is Python v2.7 so this app wouldn't be compatible
 

JasmineXU

Registered
Aug 22, 2020
4
0
1
uk
cPanel Access Level
Website Owner
What if install python 3.7? I tried to install python 3 but it seems I still need to install postgresql-devel as well to compile . I did not find a way install it because I don’t have root access.
 

cobyiv

Registered
Mar 24, 2021
2
0
1
Seattle
cPanel Access Level
Website Owner
I heard back from our developers on this, and while there isn't officially support for PGSI or ASGI applications, we would expect them to work with passenger under the new Python version.
Thanks for the response here, so every time I try to start a Python App referencing ASGI from {DJANGO_APP}.asgi import application in the passenger_wsgi.py application startup file. I get the following error log:
Code:
 PYTHON APP LOG
>> App 2812149 output: /opt/passenger-5.3.7-9.el6.cloudlinux/src/helper-scripts/wsgi-loader.py:26: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
>> App 2812149 output:   import sys, os, io, re, imp, threading, signal, traceback, socket, select, struct, logging, errno
I also tried to use this github project: stuxcrystal / passenger_asgi but that didn't help and I'm note sure what the issue is to begin with.

For some context:
My main objective is to allow for a Cpanel django app to receive a webhook and then process it asynchronously so that if the app receives many webhooks at once, the processing tasks can get qued up and run asynchronously from the app that just receives and logs the webhooks into a database. So not sure if ASGI will really allow for this to happen or if there is some other feature of Cpanel that might allow for this.

Thx
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,836
597
273
cPanel Access Level
Root Administrator
So full disclosure, I'm not a dev and will never claim to be. With that in mind.....I did have one of our devs do a quick test with that app and he had "limited success" as it loaded through passenger but then failed on the code itself, so it sounds like it may not be just you experiencing issues with that specific project.