Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

199 total results found

Flask – URL Building

Python Flask Tutorial

The url_for() function is very useful for dynamically building a URL for a specific function. The function accepts the name of a function as first argument, and one or more keyword arguments, each corresponding to the variable part of URL. The following scrip...

Flask – HTTP methods

Python Flask Tutorial

Http protocol is the foundation of data communication in world wide web. Different methods of data retrieval from specified URL are defined in this protocol. The following table summarizes different http methods − Sr.No. Methods & Description 1 ...

Flask – Templates

Python Flask Tutorial

It is possible to return the output of a function bound to a certain URL in the form of HTML. For instance, in the following script, hello() function will render ‘Hello World’ with <h1> tag attached to it. from flask import Flask app = Flask(__name__) @ap...

Flask – Static Files

Python Flask Tutorial

A web application often requires a static file such as a javascript file or a CSS file supporting the display of a web page. Usually, the web server is configured to serve them for you, but during the development, these files are served from static folder in y...

Flask – Request Object

Python Flask Tutorial

The data from a client’s web page is sent to the server as a global request object. In order to process the request data, it should be imported from the Flask module. Important attributes of request object are listed below − Form − It is a dictionary obj...

Flask – Sending Form Data to Template

Python Flask Tutorial

We have already seen that the http method can be specified in URL rule. The Form data received by the triggered function can collect it in the form of a dictionary object and forward it to a template to render it on a corresponding web page. In the following ...

Flask – Cookies

Python Flask Tutorial

A cookie is stored on a client’s computer in the form of a text file. Its purpose is to remember and track data pertaining to a client’s usage for better visitor experience and site statistics. A Request object contains a cookie’s attribute. It is a dictionar...

Flask – Sessions

Python Flask Tutorial

Like Cookie, Session data is stored on client. Session is the time interval when a client logs into a server and logs out of it. The data, which is needed to be held across this session, is stored in the client browser. A session with each client is assigned ...

Flask – Redirect & Errors

Python Flask Tutorial

Flask class has a redirect() function. When called, it returns a response object and redirects the user to another target location with specified status code. Prototype of redirect() function is as below − Flask.redirect(location, statuscode, response) ...

Flask – Message Flashing

Python Flask Tutorial

A good GUI based application provides feedback to a user about the interaction. For example, the desktop applications use dialog or message box and JavaScript uses alerts for similar purpose. Generating such informative messages is easy in Flask web applicati...

Flask – File Uploading

Python Flask Tutorial

Handling file upload in Flask is very easy. It needs an HTML form with its enctype attribute set to ‘multipart/form-data’, posting the file to a URL. The URL handler fetches file from request.files[] object and saves it to the desired location. Each uploaded ...

Flask – Extensions

Python Flask Tutorial

Flask is often referred to as a micro framework, because a core functionality includes WSGI and routing based on Werkzeug and template engine based on Jinja2. In addition, Flask framework has support for cookie and sessions as well as web helpers like JSON, st...

Flask – Mail

Python Flask Tutorial

A web based application is often required to have a feature of sending mail to the users/clients. Flask-Mail extension makes it very easy to set up a simple interface with any email server. At first, Flask-Mail extension should be installed with the help of p...

Flask – WTF

Python Flask Tutorial

One of the essential aspects of a web application is to present a user interface for the user. HTML provides a <form> tag, which is used to design an interface. A Form’s elements such as text input, radio, select etc. can be used appropriately. Data entered b...

Flask – SQLite

Python Flask Tutorial

Python has an in-built support for SQlite. SQlite3 module is shipped with Python distribution. For a detailed tutorial on using SQLite database in Python, please refer to this link. In this section we shall see how a Flask application interacts with SQLite. C...

Flask – SQLAlchemy

Python Flask Tutorial

Using raw SQL in Flask web applications to perform CRUD operations on database can be tedious. Instead, SQLAlchemy, a Python toolkit is a powerful OR Mapper that gives application developers the full power and flexibility of SQL. Flask-SQLAlchemy is the Flask ...

Flask – Sijax

Python Flask Tutorial

Sijax stands for ‘Simple Ajax’ and it is a Python/jQuery library designed to help you easily bring Ajax to your application. It uses jQuery.ajax to make AJAX requests. Installation Installation of Flask-Sijax is easy. pip install flask-sijax Configurat...

Flask – Deployment

Python Flask Tutorial

Externally Visible Server A Flask application on the development server is accessible only on the computer on which the development environment is set up. This is a default behavior, because in debugging mode, a user can execute arbitrary code on the computer...

Flask – FastCGI

Python Flask Tutorial

FastCGI is another deployment option for Flask application on web servers like nginix, lighttpd, and Cherokee. Configuring FastCGI First, you need to create the FastCGI server file. Let us call it yourapplication.fcgi. from flup.server.fcgi import WSGIServe...

Host Multiple Websites On One Apache Server On Ubuntu

Apache

1. Install Apache Web Server If you don’t have an Apache server installed refer to post: How To Install Apache On Ubuntu 20.04. 2. Create the Directory Structure First, create a document root directory for both websites by commands: 1 ...