Skip to content

flask

Introduction

Imagine having a GitHub Pages website. Now, you've migrated to project on another GitHub Pages website. As reports surfaced about users being unable to access the site, the need for a swift redirection from old URLs to the current ones became paramount.

GitHub Invertocat Logo

The catch? The solution had to operate within the constraints of a static web page, using only HTML, CSS, and JavaScript.

While conventional methods like Flask and Frozen-Flask failed, the journey led to a creative solution using HTML and JavaScript. In this blog post, I'll share the step-by-step process of how I navigated through the obstacles and achieved seamless redirection.

Flask based File Hosting (web app & api & python module & cli app)

This guide will walk you through creating a basic file hosting web application using Flask, a lightweight web framework for Python. The application will include features such as user login, file uploads, and file listing. We'll also explore adding a simple API for interacting with the application.

Prerequistes

  • python >=3.9

Setup Environment

  1. Create a requirements.txt file:
python-slugify
python-dotenv
Flask~=2.0.1

Deploying any Web application with Nginx: Example of Flask

Introduction

You have created your flask application. How nice ! Now, you want to go a step further and deploy it. For most hosting services, you have nice interfaces to deploy your python applications with support for flask. But sometimes, you only have access via ssh to the server.

This is a very straigthforward tutorial on how to do it.

This tutorial also applies to any web server you can run on local but want to deploy

Step 1: Install Nginx and Flask

Make sure you have Nginx and Flask installed on your server. If not, install them using the appropriate package manager for your operating system.

Step 2: Configure Nginx

Create a new Nginx configuration file for your Flask app in the /etc/nginx/sites-available/ directory. For example, you could name it myapp.conf. Edit the file and add the following configuration: