Why is flask app throwing an error in cpanel - flask

Can anyone let me know how to deploy a flask app on a personal website using CPanel
I have tried running it through the virtualenv but did not work

Flask is a micro framework that runs in a Python instance, and not as a set of files that are served from a web server, like HTML or PHP. Most likely you will need another hosting provider that hosts web applications like Heroku or use a VPS instead.
On the other hand, most shared hosting providers do not allow you to install custom libraries that need to be compiled.

Related

Should I use docker in order to be able to run ChomeDriver on Azure Web App Services in Django Server?

Recently I have started a Django server on Azure Web App Service, now I want to add a usage of "ChromoDriver" for web scraping, I have noticed that for that I need to install some additional Linux packages (not python) on the machine. the problem is that it gets erased on every deployment, does it mean that I should switch to Docker ?
Container works, but you can also try to pull down the additional packages in the custom start up file without messing around the machine after the deployment
https://learn.microsoft.com/en-us/azure/developer/python/tutorial-deploy-app-service-on-linux-04

Trying to deploy Django on SiteGround

I am trying to deploy a Django app on Siteground through SSH. I have transferred all the files through Filezilla. Everything is setup.
I have developed several apps on AWS using ubuntu. But in siteground Fedora OS is provided in SSH, I am not familiar with that much. I can't have superuser privileges.
Running my Django server on port 8000:
python manage.py runserver 0.0.0.0:8000
Host name is already added in ALLOWED_HOST of setting.py:
ALLOWED_HOSTS = ["himeshp7.sg-host.com","*"]
The server is running in SSH, but I am unable to open my web app on the browser. In AWS we get the option to enable ports in Security Groups, but I couldn't find anything like that on Siteground, I also talked with customer care but they are telling to upgrade, I still doubt that if it will work or not after that as I couldn't find anything proper for deploying Django on Siteground.
You need to add your server ip address to ALLOWED_HOSTS and do python manage.py runserver <your_server_ip_address>:8000 to simply run your app in Debug mode. (Replace <your_server_ip_address>). You can then access your app over port 8000
To host your app in production you need to do further more than running the app through command like installing WSGI HTTP Server, configuring to run your app on port 80 or some other port, etc.
Amazon AWS has UI for most of the things so that you could easily enable ports and such other things. This is not the case of other hosting providers.
Unless you don't have the sudo privileges there are no options to run Django app in shared hosting. Hosting providers that gives SSH/terminal access for shared hosting will not give sudo privileges for security reasons. You should be having a VPS/Dedicated account for that which costs higher to have higher control over your server.
Why do I need sudo privileges ?
You may need to install additional packages/dependencies.
To add additional apache/nginx config for your domain. etc
Otherwise you can go for hosting providers where they provide additonal "Setup Python App" in "Software" section in CPanel for their Shared Hosting Plans. You don't need to worry about server configuration.
There are many providers that gives this option in their Shared Hosting. Two of such providers that I know of:
namecheap refer
a2hosting refer
Based on the exp that I had on deploying python app on Hostgator VPS link.

Strategic error on Python/Flask deploy

I'm new to web development and deployment however I developed a web site using Python 2.7 and Flask. I can't get the site to load when the user hits the site. When testing on the server using SSH the program starts like it did on my development PC but does not render the first template and shows this error: WARNING: Do not use the development server in a production environment. Use a production WSGI server instead.
In researching that error I found an article that says Flask is not meant for a multi-user public web environment. Further investigation said: If you want to run Flask in production, be sure to use a production-ready web server like Nginx, and let your app be handled by a WSGI application server like Gunicorn.
I think what this is telling me is:
Find a provider that supports Nginx.
Install Gunicorn and then configure it to run on that host.
Doing that should allow my program to run on the host server and be accessible to the world.
Would folks with experience with Python/Flask web apps please confirm the direction I should be heading as I can't afford to go down the wrong path again.

After deploying django in AWS EB its not working similarly as it runs in localhost

This is how Admin page works in local host
This is how its showing after deploying in AWS EB
can i get help on this like how to get it normal or how to modify it using my own templates please .
In development django itself serves the files, which is not scalable in production, and thus requires you to collect your static files as documented here and serve them using your proxy server.
You can read about how collect static files in django on Elasticbeanstalk here
Before deploying run : python manage.py collectstatic
After running this you should deploy again like you usually do.

How to deploy django site on Windows server with Nginx?

Maybe anybody know easy and work solution for deploying django site on Windows machine with Nginx reverse proxy server? I can't find WSGI module, that have support in Windows.