NBA-Machine-Learning-Sports-Betting
NBA-Machine-Learning-Sports-Betting copied to clipboard
Can't Host this ML Model (502 Bad Gateway)
Hi Devs, I'm Stuck on This Project for 3 Days because I want to deploy the Flask app online. So, I can get data from anywhere online but after trying to deploy The Project on almost every Cloud and Hosting site, I'm just facing one error ( 502 Bad Gateway). No matter, if I talk about AWS, Azure, Google app engine, Vercel, Heroku, Netlify, Konbey. Everywhere I'm getting the timeout error however locally the project is working perfect and Through Clis also working but as I deploy successfully and hit end point, it says 502 Bad Gateway.
If any of you have Solution for this then for God's sake pls tell me. I'm Stuck and can't move forward.
I am having the same issue for another python program now.
However, using supervisor (http://supervisord.org/) - with supervisorctl controlling the program, it was working fine with this supervisord.conf file:
[supervisord] logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) logfile_backups=10 ; (num of main logfile rotation backups;default 10) loglevel=info ; (log level;default info; others: debug,warn,trace) pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) nodaemon=false ; (start in foreground if true;default false) minfds=1024 ; (min. avail startup file descriptors;default 1024) minprocs=200 ; (min. avail process descriptors;default 200) ;user=root ; (default is current user, required if root)
; the below section must remain in the config file for RPC ; (supervisorctl/web interface) to work, additional interfaces may be ; added by defining them in separate rpcinterface: sections [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl] serverurl=unix:///tmp/supervisord.sock ; use a unix:// URL for a unix socket
[program:my_python_program] command=python3.11 /opt/my_python_directory/my_python_program.py directory=/opt/my_python_directory/ autostart=true autorestart=true stderr_logfile=/opt/my_python_directory/my_python_program.err.log stdout_logfile=/opt/my_python_directory/my_python_program.out.log
[inet_http_server] port = 127.0.0.1:9001
Making for another.
Using Nginx reverse proxy to Python Flask and just noticed it is working with running Nginx in debug mode:
sudo systemctl start nginx-debug
Regarding Supervisor - also working with nginx-debug - starting it like this:
supervisord -c /opt/my-python-directory/supervisord.conf
Controlling it with: supervisorctl status supervisorctl stop all supervisorctl start my-python-program ...