How setup python app without 'setup python app' option

vitor30221771

Member
Nov 3, 2022
18
2
3
Curitiba PR
cPanel Access Level
Website Owner
Recently, In my cpanel, we've installed python 3.7. The default python is 2.7 yet, but I can use python 3.7, simply typing in terminal 'python 3.7<python command>'

the problem is, I dont have the 'setup python app' option, neither 'application manager'. So, I tried to setup by terminal, but I don't know how to do this.

I need to setup a flask API and my first attempt was setup it like I normally setup my localhost
1. I create a directory called: myuser/apis/myapp.
2. Acess it in terminal and create a virtual env in this folder
3. Activate the venv with: source ./venv/bin/activate
4- Install requirements: pip install -r requirements.txt
5- Run app with: flask run

1677240795351.png


The app seems to working, but my host is: 127.0.0.1:5000 (localhost). How can I set this to my domain and run keep this process running? With my experience with other hosts, I allways use a Procfile serving my app with gunicorn

By the way, I have this app working in digital ocean and the following command is used to serve my app (this is setted by digital ocean automatically):
run_command: GUNICORN_CMD_ARGS="--bind=0.0.0.0:8080 --workers=5" gunicorn server:app

By the way², I don't have root acess, but I can activate venv and install dependencies, so I think I have permission to setup a python process
 
Last edited:

vitor30221771

Member
Nov 3, 2022
18
2
3
Curitiba PR
cPanel Access Level
Website Owner
By the way, I figure some things;
1- I can run my python script and my front end in the same server can acess it without problems - but this service is not executed all the time
2- I need to setup a deamon in linux, but I dont have the root acess to do this
3- I need to serve my python API using gunicorn, where was installed inside venv. So when I create this deamon, in some way, I need to point the venv,
4- I think this so complex to setup a simple api and I will need to this multiples time, so the unique solution is make 'setup python app' available.
5- Where can I buy this software option? In WHM? Or need to contact my host where cpanel was installed?
6- thinking seriously in use digital ocean or heroku to keep the APIS and use cpanel only for frontend apps and mysql service.

In your opinion, what you think about keep my apis outside cpanel and why?

Appreciate any help/opinion :D
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,163
2,409
363
cPanel Access Level
Root Administrator
Hey there! I don't have any official recommendations for this type of behavior, as performing the work in this method outside of the cPanel tools isn't something we could provide support for. It might be easiest to ask your hosting provider if they could enable those tools for your accounts so you had them directly in the interface.

I'll leave this thread marked as new for a bit to see if other users have more ideas about this.
 
  • Like
Reactions: vitor30221771