Posts Related To Flask (49)

Unit Testing in Flask

Unit Testing in Flask

Testing is so fundamental in good software development that there is even a process based on testing, called Test-driven development (TDD). TDD allows for test cases to be specified and validated prior to building an application. A TDD approach to software development is meant to encourage simple designs and inspire confidence.

A software developer is encouraged to begin by writing tests, which fail at the start for obvious and expected reasons. An effort is then made to write the simplest code that passes the new test. This change should see that the test case passes. Depending on the size of an application, the developer will need to refactor the code as much as needed using each test to ensure that the functionality is preserved.

The cycle is repeated for each new piece of functionality. Fundamentally, tests should be small and incremental, and commits made often. This allows the developer to undo or revert the failed tests than debug excessively.

Joined Table Inheritance In SQLAlchemy

Joined Table Inheritance In SQLAlchemy

A properly designed database allows us to organize our data in the most efficient manner. We will also have the luxury to access up-to-date and well-curated data. Because a solid design is essential to achieving our goals when working with a database, it is essential that we invest the time to learn good design principles. Designing a database schema is a task that’s easier said than done—but by observing a few tips, principles, and best practices, we’ll be much better positioned for success. This article reviews the concept of Joined Table Inheritance from SQLAlchemy.

Monitor Your Live Server On Linode

Monitor Your Live Server On Linode

Once your application is live in your virtual machine, the only way to know that your Linux-server-based applications and services are running well is to measure what’s going on in the server and its connectivity status. A handful of Linux monitoring tools are available to help reassure us that things are working right and that anomalies are quickly recognized. Mastery of these dedicated tools, most of which are already built into the operating system, places us well on the trajectory of Linux system administrator expertise.

Configure PostgreSQL In A Live Linux Server

Configure PostgreSQL In A Live Linux Server

PostgreSQL is a feature-rich application, offering advanced features such as materialized views, triggers, and stored procedures. It can handle a very high workload, including data warehouses or highly-scaled web applications, and is noted for its stability.

Understanding Cronjobs in Flask

Understanding Cronjobs in Flask

It is common for web applications to run background tasks. The applications could need to clear unnecessary files or cache, import third-party data, or even periodically send out email newsletters. Thankfully, all Unix-based have a scheduling utility that makes it possible to automate certain tasks.

Tinker Education Elearning App

Tinker Education Elearning App

A newsletter application plays an important role when launching a new product. As a business, you'd want to collect user interest in your new product or service prior to the launch for the purposes of decision-making.

Download and Encrypt PDFs in Flask

Download and Encrypt PDFs in Flask

PDF documents are not editable by nature. They are the sole read-only file format that can’t be altered without leaving a footprint. This allows the effective tracking of changes in respective documents. Encryption can be enabled in the document to protect it wherever it goes, independent of storage or transport. As complex as this entire document creation and encryption process seems to be, Flask allows for the integration of this feature in an application.

Visualize Data In Your Flask App Using ChartJS

Visualize Data In Your Flask App Using ChartJS

Data visualization is the graphic representation of information. This could be in the form of a chart, diagram, map, or picture. In the world of Big Data, data visualization tools and technologies are essential for analyzing large datasets and making data-driven decisions.

ChartJs is a free and open-source JavaScript library used to make HTML-based charts. It is powerful enough to reproduce very responsive charts and plots. You can use it to plot static and constantly changing data.

Push Notifications Using Twilio Authy API In Flask

Push Notifications Using Twilio Authy API In Flask

Push notifications are messages that pop up on a user’s mobile phone or desktop device via their chosen web browser. These little banners slide into view — whether or not your app or website is open.

Push notification can also be used to authenticate a user silently without requiring their active participation in the authentication process as is the case with token-based methods. All a user needs to do is click a button to either approve or deny access to an account.

Two-factor Authentication Using Twilio Verify API In Flask

Two-factor Authentication Using Twilio Verify API In Flask

The Twilio Verify Rest API allows you to verify that a user has a claimed device in their possession. This device will receive a verification code that could be used to authenticate a user into an account. You can choose what channels you'd like to use to verify a user of an application, either via SMS, voice, WhatsApp or email.

Time-based One-Time Password Authentication In Flask

Time-based One-Time Password Authentication In Flask

Two-factor authentication (2FA) is a security protocol that protects users by asking them to verify their identity using two methods of authentication. Organizations use 2FA techniques to safeguard their clients' data from unauthorized access.

Time-based one-time password (TOTP) is one method of implementing two-factor authentication where users are required to not only provide their passwords, but also a time-bound numeric token sent to their device. The token is counter-checked against a generated token before access is granted.

User Authentication In Flask

User Authentication In Flask

User authentication is a method that keeps unauthorized users from accessing sensitive information. Depending on the application, user data may be limited to only those with access to an account.

Typically, users are identified by their username, email, phone number, or password. The most basic form of user authentication is the password-based type. However, due to several reasons, this method does not guarantee the security of a user's account.

There are several other technologies we can utilize to help ensure that a user of an online application is safe from exposure and potential damage. In this article, we will look at a few methods that can be implemented in Flask to ensure data safety.

Comment Moderation In Flask

Comment Moderation In Flask

As an administrator of an online application, have you been worried about the quality of comments that appear on your site? Comment moderation is an attempt to promote healthy conversations on your platform.

Typically, a user may register and jump into the comments section to experience the application's community. To ensure that warm engagements are maintained throughout, moderators will have first access to all user comments before allowing them into the community.

Integrate Google Recaptcha In Flask Web Forms

Integrate Google Recaptcha In Flask Web Forms

It is fairly common that web forms can be misused, sometimes for malicious reasons. As a developer, how do you protect against automated responses? You can use the Completely Automated Public Turing test, a type of challenge-response test, to tell computers from humans.

Although CAPTCHAs are designed to block automated bots, CAPTCHAs are themselves automated. They're programmed to pop up in certain places on a website, and they automatically pass or fail users.

Handling Rich Text In Flask

Handling Rich Text In Flask

Rich text is a more exciting way of writing text, where you have the option to add common formatting features such as bold, italics, links, and more, commonly found in 'what you see is what you get' text editors. Additionally, you can have a preview of the text you are writing so as to know what the output will look like eventually.

How To Deploy A Flask App On Docker Containers

How To Deploy A Flask App On Docker Containers

Docker is an open-source containerization platform. It enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment. The isolation and security allow you to run many containers simultaneously on a given host.

More portable and resource-efficient than virtual machines (VMs), containers have become the de facto compute units of modern cloud-native applications.

How To Install Docker in Ubuntu 20.04

How To Install Docker in Ubuntu 20.04

Docker is an application that allows you to manage application processes using containers. These containers work in a similar manner as virtual machines but are rather more portable, resource-friendly and OS-dependant. In this tutorial, you’ll install and use Docker Community Edition (CE) on Ubuntu 20.04.

Welcome to Linode

Welcome to Linode

Flask provides a built-in development server to be used during testing. Unfortunately, this server has serious limitations beyond testing purposes. This is by design and true to Flask's core philosophy of being lean but extensible. In production, Flask recommends that you look elsewhere, such as at Heroku, Python Anywhere among others. Most of these hosting servers are cloud-based, and they do an excellent job of lifting the heavy burden of server setup, hosting and maintenance from the developer.

On the other side, if you would like to know and understand what goes on behind the hosting services, you can choose to host your flask application yourself. Your Flask application, being Python-based, will require a Linux server for self-hosting needs. This is where Linode comes in.

Secure Your Domain Name With SSL

Secure Your Domain Name With SSL

If you want your website visitors and potential customers to trust your site, you need a SSL or TLS certificate installed on your website. SSL is a technology that keeps your website visitors' personal information private when they submit it to your site. If your website isn’t secure, or doesn’t use TLS, formerly known as SSL, then hackers can intercept and read the information being transmitted. This is called a man-in-the-middle attack, and the consequences can be devastating.

For some time now, Google has categorically been using HTTPS as a ranking signal in search results. This means that if your website has SSL then it’s more likely to show up higher in SERPs (search engine result pages) than a site that isn’t secure.

Buy A Domain Name For Your Deployed Flask Application

Buy A Domain Name For Your Deployed Flask Application

Every website on the internet has an IP address. These addresses point to a website's location. IP addresses are generally a set of numbers such as 142.250.203.206. These addresses can quickly become difficult to remember, more so if you have multiple websites' IP addresses. A domain name is a memorable name that maps to a particular website's IP address, and are typically what you would type in a browser's URL bar. An example of a domain name mapping to the IP 142.250.203.206 is google.com.

If you have deployed an application on a server, say a Linux server, your host has assigned your application an IP address. You can get yourself a memorable domain name that your users can easily recall when interacting with your application on the internet.

Welcome to Linode

Welcome to Linode

Flask provides a built-in development server to be used during testing. Unfortunately, this server has serious limitations beyond testing purposes. This is by design and true to Flask's core philosophy of being lean but extensible. In production, Flask recommends that you look elsewhere, such as at Heroku, Python Anywhere among others. Most of these hosting servers are cloud-based, and they do an excellent job of lifting the heavy burden of server setup, hosting and maintenance from the developer.

On the other side, if you would like to know and understand what goes on behind the hosting services, you can choose to host your flask application yourself. Your Flask application, being Python-based, will require a Linux server for self-hosting needs. This is where Linode comes in.