Python


Enable Login with Email in Django

Django is currently my favorite framework for building web applications. Despite its simplicity and delightful development experience, one of the things that I personally don’t like about Django is its default authentication system. I don’t know why they’re doing this, but for me, log in with username doesn’t meet the web industry standards.

Apparently, this problem can be fixed solved easily with some hacks. Let’s take a look at the steps on how to enable your users to login with their emails in your Django apps.

Read more


How to Build a REST API with Flask and SQLAlchemy

Flask is a great framework that enables you to build web applications quickly with Python. It’s fast, small, and fun to work with. In this tutorial, we’re going to build a RESTful API with Flask framework, and some other supporting tools.

The objective of this tutorial is to understand the concept of building a Flask server from the ground up, learn how to commuticate with SQL databases via object-relational mapper, as well as design a RESTful API with object-oriented design pattern.

Read more


Run External Program with Subprocess in Python

There are many scenarios where you want to write a small programs that are designed to automate simple tasks. For instance, you want to resize thousands of images in your computer to a smaller sizes, or send email to multiple user whenever a row of data added into a csv file.

This is what people usually called scripting. And Python is a powerful programming language for this kind of job. Because, there are a bunch of built-in modules and third-party libraries that helps you to do some cool automation stuff with Python.

Read more


Render Bootstrap Form in Django

Dealing with user input is a very common task in modern web applications. Luckily, Django offers a convenient way to handle user input through forms. You can just build your form schema in your logic and render it through the template context without thinking about it.

By default, Django renders your form fields without any CSS class or styling. That is a great thing if you want to use your custom CSS styling. But in some cases, you want to use CSS libraries like Bootstrap to increase your productivity.

Read more