How to enable Gzip compression in flask? - flask

I have deployed a flask app using heroku. I want to enable gzip compression in it. Usually the tutorials and videos on the youtube show gzip compression for php, wordpress and apache server but how can we do it if we are deploying a flask app using heroku

Related

Can I host a dynamic Flask application on GitHub pages?

I have a web app made with Flask and I want to host it on GitHub pages. However, GitHub pages can't run Python apps, and I can't use something like Frozen-Flask because my app is dynamic.

django- host a website without python app on cpanel?

I am going to host a website build on the Django framework. There are tutorials on youtube on how to host but they all are using the python app already on Cpanel. But my hosting provider Hostgator does not give the python app in Cpanel. is there any other way to host the Django website without the python app on Cpanel?
you can host django on digital ocean, with ssh command in the terminal, where you can configure your server with nginx and gunicorn.
tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04-pt
follow the taps.

Can I dockerize only Django (backend) with React JS (frontend) rendered on same server as Django runs on?

I've developed Django as backend with ReactJS as frontend being served on Django server (127.0.0.1:8000) by putting frontend folder inside backend folder and using static files with path to build/static of frontend in settings.py. So I'm able to run reactjs app on localhost:8000. That's fine.
Now question is if it's possible to dockerize only Django backend, which will have everything including frontend contents and run single docker container opening react js app? Or shall I dockerize frontend as well separately?
Looking forward to your inputs.
Regards
Please note that I've also done with both backend and frontend running separately on 2 servers (localhost:8000 and localhost:3000), used docker-compose to build 2 dockerfiles and them talking each other. So my above q is about possibility to dockerize only backend as a single container image which has frontend static files inside.

Angular django rest framework integration

How to serve angular using Django server?
I don't want to host two different server for angular and Django. How to do it with a single django server?
I have developed frontend application using angular 6 and backend using DRF. I am running django server in the back end and using ng serve command to run angular application.
To achieve this, you should serve your Angular project in production mode. This is a must have if you seriously deploy your project to the world, Angular will optimize the bundle to make UX better than on development mode.
And also for Django project, you should deploy it using gunicorn or uwsgi and using nginx as a reverse proxy (reference this gist) for your application.
Hope that helps!

Why is flask app throwing an error in cpanel

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.