Category: Flask Web Framework
-
Flask session simplest example
Flask sessions are useful when we want to remember a specific user. For example to know the user already visited the website before. So we can generate dynamic content for that user. Or we can use login based system In this code we will use the simplest flask session example Run the code go the…
-
Expiring Links Tutorial: Python Flask One-Time Link Generator
One time links are essential where users want to share resources with co-worker or friend’s effortlessly but at the same time restrict other from access. Its works best because the link automatically inactive if some one go to the link for the first time. That means the same link will not work for the second…
-
Create your first chat application with Flask and Socketio
We will use socketio for real-time messaging First install our dependency for this application pip install flask pip install flask-socketio Copy Code How it will work. Every user will get an unique key. If the the other user submit the other users key that will send the message. its like sending message to unique username…
-
Ajax example with flask
One of the best ajax applied in real world is username checker. In this example we will check if there is existing username This is code /project we will Our first step: Check if username exists or not Imagine we have this existing username when the user enter a username we will check it from…
-
Flask testing environment ssl solution with “adhoc”
Why? When I started developing video calling application at one point I faced this situation. In single pc(on localhost 127.0.0.1) everything works very well but when I need to test another pc on the same network for example(wifi) . Before on public production environment I wanted to test my own private network which was established…
-
Building a Simple and Secure API with Python Flask
Server-Side: Flask API Development We will build a simple API that will tell the current time. And then add more feature. The explanation and the code The code from flask import Flask, request, jsonify from datetime import datetime app = Flask(__name__) # Define a route to get the current time @app.route(‘/get-current-time’, methods=[‘POST’]) def get_current_time(): #…
-
Flask File Handling Made Easy: Upload and Download Files
Very basic example code_features This is our first example… Run this code first. Then read the step by step explanation. That will be more effective. Because this tutorial is all about practice. In this article covers simple upload, upload to database, securing the upload by adding limiting file extension and adding download link… Run the…
-
How to Create a Flask Login Page
In this example we will explore First Lets create a Login page with html <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> </head> <body> <h2>Login</h2> <form method=”POST” action=”/login”> <label for=”username”>Username:</label> <input type=”text” id=”username” name=”username” required><br><br> <label for=”password”>Password:</label> <input type=”password” id=”password” name=”password” required><br><br> <button type=”submit”>Login</button> </form> </body> </html> Copy Now write our basic…