My (nick)name is Sm0ke and I'm using Flask for more than 5 years to code almost anything: simple one-page projects, API's and eCommerce-based platforms. The deployments were made starting with Apache, Nginx, Gunicorn, and uWSGI .. etc. Regarding this Flask Tutorial, the content will be provided based on your questions, starting with just a few links.
Thank you! Content provided by AppSeed - App Generator.
I'll be around here for 3hours - feel free to ask me anything. During this timeframe I'll do my best to provide quality answers based on my practical knowledge - Some Flask-related links:
- Flask - the official website
- Flask Docs
- Flask Tutorial - (Github) Content provided by experienced developers.
- Flask - A list of useful “HOW TO’s”
- Flask Cheat Sheet - And FREE samples
- Deployment on CentOS, Ubuntu using Apache/Nginx
- Start app using Gunicorn, uWSGI
- What is WSGI
- How to structure a project
- ORM - how to use it and manage DB information with ease
- Migrations - using Flask Migration
- Flask Admin - using roles in a Flask application
- Protecting routes in Flask
- Session-based authentication via Flask-Login
- Using the Flask CLI
- Create custom (CLI) commands using Click
- Create tables dynamically - at first request
Top comments (20)
Hello what is the simplest and cheapest way to deploy a flask site?
I am beginner and recently I had an opportunity to make a landing page for an architecture agency, and I saw that flask is very easy to use, but I am seeing that some shared hostings doesn't support python. What you suggest me to do, or do I have to change stack. Thank you.
Heroku has a free tier and is super easy to set up.
Another option is to buy a 5$ Droplet on DigitalOcean and use it for many projects.
Also, using a raw droplet, and make your own configuration in Apache/Nginx you will learn a lot.
Hello Sm0ke and Thanks for your time!
Can I use Flask embedded server for a production deploy?
I'm a beginner and configuring Apache/Nginx is not an easy job for me.
Flask provides the embedded server mostly for development purposes. As mentioned on the official docs regarding the deployment, "Flask’s built-in server is not suitable for production".
Besides this warning, I see two major problems:
Even is not a simple task to configure a server, once you learn to do it, your application will be faster and secure.
Hi... thanks for your effort...
I was thinking of creating a folder in my flask project which is synchronized with my database... So that to speed up the speed...
Is this possible???
Your pattern is quite original. Can you elaborate, please?
If you want to speed up things, not only in Flask, you have at least two options:
If you have the time, please access this guide related to Flask:
Your link is so rich of important information... I couldn't stop reading... Are you by any chance Smirnov???
Concerning speed, since querying a database takes time... I thought of creating a folder that does a query to the db only after each update for synchronization (mirror of db) ... So it should be acting similar to flatpages.
Smirnov??? .. who's this guy?
Between flatpages and DB pretty sure DB is faster and easier to locate the information.
On top of this, Redis is usually a solution to by-pass the DB queries.
Hi, a second question please...
Concerning security, does one have to depend on extensions to gain full security, or is Flask enough... I am asking this question because a developer can stop maintaining his extension and apps relying on it gets buggy.
Secure a web app is not an easy job but Flask helps a lot regarding this sensitive topic.
When your application uses a public module it might be a good idea to check a few relevant metrics:
Also, you can open a discussion on StackOverflow/Reddit and get answers from other coders with a similar concern.
Usually, I'm checking the new modules by following this short checklist.
P.S. If you are using Github, feel free to use Flask Tutorial to get answers related to Flask.
Cool idea. What are blueprints? When is recommended to use BP.
Blueprints are basically modules, similar to
Once a project is getting bigger, the files tend to become huge and not so easy to handle.
Using Blueprints, we can split the features using a modular structure. The official documentation is nicely written. Take a look and let me know if your thoughts.
is flask able to have endpoints closed/opened on command?
Can you elaborate, please?
if your Q address something like a dynamic routing based on the input, I think you can manage this in a controller and bypass the classic Flask routing:
Do you have/Can you recommend a repo for a docker(-compose) setup dev+prod ?
I've built some starters in Flask, already Dockerized. For sure the repos are not the best on the
marketbut can be used to have a good start:
Both are tested and released under MIT License.
Thank you very much for this article and explanation.
Yw & Thanks for stopping by.