Skip to content

Python · Machine Learning

From the kitchen

Quality, author-led articles on Python & machine learning. Learn how to eat through topics, calmly, deeply, and without the noise.

145 articles Community authors Always free

More from the kitchen

Fresh articles, served often.

web development

How to implement notification in Flask

Implementing notifications in Flask goes way beyond using flash. You have to add this snippet in your templates: <div id="flashed-messages"> {% with m…

Abdur-Rahmaan Janhangeer

Chef

security

Securing Flask: Preventing Open Redirect Vulnerabilities

If your Flask application uses a next parameter to redirect users after login, you might be vulnerable to Open Redirects. This is a subtle but dangerous vulnera…

Abdur-Rahmaan Janhangeer

Chef

web development

How to Define Global Template Variables in Flask

When building Flask applications, it is very common to reuse the same variables across multiple templates. These may include application-level configuration, branding details, environment flags, or…

Abdur-Rahmaan Janhangeer

Chef

security

How to disable csrf protection for particular routes in Flask-wtf

Flask-wtf recommends using @csrf.exempt to disable csrf protection for particular routes as in the case of APIs. Now this is pretty confusing. What does csrf refers to? I…

Abdur-Rahmaan Janhangeer

Chef

web development

How to use Flask-admin with Flask-login

Steps: Have a login route accept a next parameter Define your model view and admin index view Register models In the example below, auth.login is the lo…

Abdur-Rahmaan Janhangeer

Chef

web development

How to correctly use the next parameter in login and logout in Flask

Here is a sample login and logout route taken from the shopyo web framework. You can learn …

Abdur-Rahmaan Janhangeer

Chef

software engineering

The Zen Of Python: A Most In Depth Article

Note: I wrote a quite complete article on the Zen but for some reason it went down in seo history. I am tired seeing people write ‘in-depth’ article with commentaries from the top of their head…

Abdur-Rahmaan Janhangeer

Chef

software engineering

Python Generators: The In-depth Article You've Always Wanted

Table of contents Why were Python generators introduced? How do Python Generators differ from normal functions? Execution flow Immediate usefulness …

Abdur-Rahmaan Janhangeer

Chef

game development

Realtime CPU monitor using PyGame

Here’s a realtime CPU monitor using PyGame: ''' Author: https://github.com/Abdur-rahmaanJ Instructions: pip install psutil hooman==0.3.6 ''' from hooman…

Abdur-Rahmaan Janhangeer

Chef

game development

Display Most Frequent Words Using Pygame

""" Author: Abdur-Rahmaan Janhangeer Github: https://github.com/Abdur-rahmaanJ Instructions: pip install hooman """ from hooman import Hooman import pygame from …

Abdur-Rahmaan Janhangeer

Chef

devops

Python: Running makefile on windows using git mingw bash

Linux owners configure makefiles so as to have easy commands to perform operations such as make dependencies to pip install required packages. Here are the dry simple steps to run make…

Abdur-Rahmaan Janhangeer

Chef

web development

How to run a Flask Linux-only App on Windows - The AFPy Site

There are in the Python world many Flask Linux-only apps. However in many case, with some twerking we can make them work on Windows. We’ll take the case of the AFPy site. First fork the …

Abdur-Rahmaan Janhangeer

Chef