Flask Flashcards

πŸ”₯ Flask Flashcards
πŸ’‘ What is Flask?
A lightweight WSGI web application framework in Python that’s easy to extend and simple to use.

πŸš€ Is Flask asynchronous?
Flask itself is synchronous, but you can integrate it with asyncio or use frameworks like Quart for async support.

πŸ“¦ How do you install Flask?
Use pip install Flask to install Flask via pip.

πŸ”— What is a Flask route?
A URL pattern defined in your app using the @app.route() decorator to bind functions to URLs.

πŸ—‚οΈ How to handle templates?
Flask uses Jinja2 templating engine to render HTML files from a ‘templates’ folder.

πŸ” How to manage sessions?
Flask provides a secure session object stored in cookies, using a secret key.

πŸ§ͺ How to test a Flask app?
Use Flask’s built-in test client along with pytest or unittest for integration and unit testing.

🌐 Can Flask build APIs?
Yes, Flask is commonly used to build REST APIs using routes and JSON responses.

πŸ” How to enable CORS?
Use the flask-cors extension to allow cross-origin requests.

πŸ“ Where are static files stored?
In a folder named static within your Flask project; accessible via url_for('static', ...).