Хлоя (Chloe)'s profile picture

Published by

published
updated

Category: Web, HTML, Tech

8/21/2025 | Python Flask App Stack

8/21/2025 | Python Flask App Stack

Note:

I am done writing code for fun, I will probably never do it again. I do it every day for work and at the end of the day I am exhausted. That said - I am giving away my most clever (or stupid) tech stack / project knowledge. I'll make a few of these posts.

General Overview:

The purpose of this stack / setup is flexability, portability, and reaching as many platforms as possible. It runs with OR without the internet, privately or publicly, for one user or many. It can be deployed offline as a pseudo desktop executable, on a local network that drops external traffic at the server layer, or deployed publicly to an internet facing web server.

Backend:

Python & Flask. FLASK is a web app framework, it is how you serve your webpages. So at its core, this is just a webapp. What is special is how you package it.

Method 1 - the private-native web app:
You can add some code on the server side of things (Flask) that drops any traffic coming from outside of localhost. You can have the Python code launch the user's browser on startup and navigate to localhost on the appropriate port to load your webpage. You can also compile (yes COMPILE) your Python program into an executable using a tool like PyInstaller. Then you can use an install wizard creator to create, well, an install wizard. Then you can send your exe out there into the world! User's can download the executable and run it and it will launch a website right there on their computer. If they haven't done any network configuring, it won't be accessible off their network. If you added code to drop traffic coming from anyone other than localhost, then it is limited to the user's own machine! Wow! A web app running like a native application.. sorta.

Method 2 - the semi-local web app:
The same as Method 1, but your user will need to do some network configuration. They will need to open the port your web app is using to internal traffic (forward to the port internally, refuse traffic externally). You can also have your server side code drop attempted connections from outside of the network. I feel like this would work well in a business setting where multiple terminals / instances need to communicate with one another. Maybe self checkout machines, Sonic drive-in kiosks, or gas pumps on the same network could do something like this?

Method 3 - the classic web app:
Of course, you can just deploy this to a webserver as Flask is intended to be used and run a normal web app.

Frontend:

The front-end is just, well, a website. HTML/CSS/JS. You can get fancy and do typescript if you want. Where flexibility is added using this stack is that if you build mobile friendly web pages your app will work on mobile devices! Cool huh? Because its... just a website.

Database:

There's a million database solutions, I like SQLite for my Flask junk. It is simple and easy to spin up. All you need is the Python package to interact with SQLite and a database file (just make an empty file something like mydatabase.db) in the same directory as your executable (or interpreted Python file). Or somewhere accessible by it..

Summary:

So yeah that's about it. Nothing ground breaking here really. I thought the way you can make a Flask app pretend to be a native app was a little clever but it has its obvious limitations.


0 Kudos

Comments

Displaying 0 of 0 comments ( View all | Add Comment )