blog.miguelgrinberg.com
Open in
urlscan Pro
138.68.45.120
Public Scan
Submitted URL: http://miguelgrinberg.com/
Effective URL: https://blog.miguelgrinberg.com/
Submission Tags: tranco_l324
Submission: On November 21 via api from DE — Scanned from DE
Effective URL: https://blog.miguelgrinberg.com/
Submission Tags: tranco_l324
Submission: On November 21 via api from DE — Scanned from DE
Form analysis
0 forms found in the DOMText Content
Toggle navigation miguelgrinberg.com * Home * My Courses * About Me * Hire me! * October 31 2021 ADD A WEBSOCKET ROUTE TO YOUR FLASK 2.X APPLICATION Posted by Miguel Grinberg under Flask, Programming, Python. The WebSocket protocol was standardized 10 years ago (in 2011, can you believe it?) so I'm sure for many of it you does not need an introduction. But in case you are not familiar with it, WebSocket is an extension to the HTTP protocol that provides a permanent, bi-directional communication channel between a client and the server, where both sides can send and receive data in real time, free of the constraints of the request/response cycle of HTTP. Flask, being a minimalist web framework, does not have WebSocket support built-in. The old Flask-Sockets extension, which has not been maintained in the last few years, provided support for this protocol. My own Flask-SocketIO extension has also been a favorite, but this is Socket.IO, which is a more complex protocol that combines WebSocket and HTTP. The good news is that if you are using Flask 2 you now have a new extension (also created by myself) called Flask-Sock, which provides modern WebSocket support for your application. In this article I'm going to show you how to work with this extension. This article was voted by my supporters on Patreon. Would you like to support my work, and as a thank you be able to vote on my future articles and also have access to a chat room where I hang out? Become a Patron! 2 COMMENTS Read more... October 3 2021 ACCEPT CREDIT CARD PAYMENTS IN FLASK WITH STRIPE CHECKOUT Posted by Miguel Grinberg under Programming, Flask, Python. In this article I'm going to show you how to implement an order page for your Flask application that you can use to sell products or services online. The solution I'm going to present to you uses Stripe Checkout, a secure and easy to use credit card charging service that integrates nicely with Flask. This article was voted by my supporters on Patreon. Would you like to support my work, and as a thank you be able to vote on my future articles and also have access to a chat room where I hang out and answer questions? Become a Patron! 4 COMMENTS Read more... September 1 2021 OPTIMIZING SLOW SQL QUERIES Posted by Miguel Grinberg under Database, Programming. Most database problems go unnoticed during development, because we tend to code our applications using small datasets. It is when the application has been on production for some time that database performance issues start to appear, causing parts of the application to become slower and slower as the database continues to grow. How do you debug and identify this type of problems? In this article I'm going to show you how to fix the most common database performance problems, which are those that are caused by improper indexing. Examples for Postgres, MySQL and SQLite are included! This article was voted by my supporters on Patreon. Would you like to support my work, and as a thank you be able to vote on my future articles and have access to a chat room where I hang out and answer questions? Become a Patron! 3 COMMENTS Read more... July 29 2021 HOW TO WRITE UNIT TESTS IN PYTHON, PART 3: WEB APPLICATIONS Posted by Miguel Grinberg under Programming, Python. This is the third part in my series about unit testing Python applications. In this article I'm going to show you some of the techniques I use when I work with Python web applications. For the examples in this article I will be using the Flask framework (I know, what a surprise!), but the concepts I'll show you are universal and can be applied to other frameworks as well. While this is the first article in the series that covers web applications, I will be applying many of the ideas and solutions I shared in the first and second parts, so be sure to check those out first, even if you are only interested in web applications. 7 COMMENTS Read more... July 14 2021 FLASK MEGA-TUTORIAL UPDATE: FLASK 2.0 AND MORE! Posted by Miguel Grinberg under Flask, Python, Programming. I'm excited to share that I've completed a revision of the Flask Mega-Tutorial to keep it in line with new releases of Flask, Python and third-party dependencies. To celebrate this update, you can purchase the paid version of this course with a $10 USD discount (this offer is valid through the rest of July 2021). If you are interested in this offer, use the FLASK2 promotional code at checkout, or click here to go directly to the order page with the coupon added. Thank you! 27 COMMENTS Read more... June 27 2021 BEAUTIFUL INTERACTIVE TABLES FOR YOUR FLASK TEMPLATES Posted by Miguel Grinberg under Flask, Programming, Python. Rendering a table with data in a Flask template is a relatively simple task when the table is short, but can be incredibly hard for larger tables that require features such as sorting, pagination and searching. In this article I'm going to show you how to integrate the dataTables.js library in your templates, which will allow you to create fully featured tables with ease! 33 COMMENTS Read more... June 13 2021 HOW TO DOCKERIZE A REACT + FLASK PROJECT Posted by Miguel Grinberg under Python, JavaScript, Flask, Programming, Docker, React. This is the fourth article in my series about working with a combined Flask and React project. In this part I'm going to cover how to deploy the application in Docker containers. 21 COMMENTS Read more... May 17 2021 DYNAMICALLY UPDATE YOUR FLASK WEB PAGES USING TURBO-FLASK Posted by Miguel Grinberg under Flask, Programming, Python. How can you update a part of a web page dynamically, without the user having to hit the refresh button on the browser? This is a question that is frequently asked on the Internet. If you have some knowledge of JavaScript this is relatively easy to do, more so if you use a front end web framework such as React or Vue. But what if you have a standard web application written in Flask and Jinja templates? In this article I'm going to introduce you to my Turbo-Flask extension, which will allow your Flask application to easily push asynchronous page updates to the browser, without having to write any JavaScript code. In the screenshot below, note how the CPU load numbers update without the user doing anything. 34 COMMENTS Read more... April 6 2021 HOW TO WRITE UNIT TESTS IN PYTHON, PART 2: GAME OF LIFE Posted by Miguel Grinberg under Programming, Python. This is the second part of my series on unit testing Python applications. In this article I will introduce you to Conway's Game of Life, an interesting simulation that plays animated patterns on a grid. My implementation of this game has an engine part, where the data structures and algorithm of the simulation are implemented, and a graphical user interface (GUI) part. In this article I will focus on testing the engine (testing GUIs will be covered in a future article). Testing this code will present us with a few new challenges. In this article you will learn about the following topics: * Test parametrization * Building test matrices * Basic mocking * Testing Python exceptions 11 COMMENTS Read more... February 17 2021 HOW TO WRITE UNIT TESTS IN PYTHON, PART 1: FIZZ BUZZ Posted by Miguel Grinberg under Python, Programming. Today I'm starting a new series of articles about a topic that does not get a lot of coverage: how to write Python unit tests. Unlike other testing tutorials, I'm going to focus on testing techniques more than on the testing tools themselves. The idea is that in each part of this series I will look at a particular piece of code and discuss the challenges it presents from a testing point of view and how to address them. In this first part I'm going to introduce the testing set up that I use in my projects, which is based on pytest. Then I will show you how to write unit tests for an implementation of the popular fizz buzz game that is frequently the subject of coding interview exercises. 20 COMMENTS Read more... * ← Newer Posts * Older Posts → FLASK WEB DEVELOPMENT, 2ND EDITION If you want to learn modern web development techniques with Python and Flask, you may find the second edition of my O'Reilly book useful: ABOUT MIGUEL Welcome to my blog! I'm a software engineer, photographer and filmmaker, currently living in Drogheda, Ireland. You can also find me on Facebook, Google+, LinkedIn, Github and Twitter. Thank you for visiting! CATEGORIES * AWS (1) * Arduino (7) * Authentication (6) * Blog (1) * C++ (5) * Cloud (8) * Database (16) * Docker (2) * Filmmaking (6) * Flask (97) * Games (1) * HTML5 (1) * Heroku (1) * IoT (8) * JavaScript (16) * MicroPython (8) * Microservices (2) * Movie Reviews (5) * OpenStack (1) * Personal (3) * Photography (7) * Product Reviews (2) * Programming (139) * Project Management (1) * Python (132) * REST (6) * Rackspace (1) * Raspberry Pi (7) * React (5) * Robotics (6) * Security (10) * Video (22) * Webcast (3) * Windows (1) © 2012-2021 by Miguel Grinberg. All rights reserved. Questions?