When it comes to dynamic web apps, the database is a crucial component. But is it possible to create a dynamic web app with a login/register form and dynamic data display without using a database? The answer is yes! In this post, I will explain how you can easily create a dynamic website without any traditional databases like MySQL or PostgreSQL. Make sure to share this post with your friends and leave your feedback in the comments below. Let’s get started! 😊
Storing the Data in the JSON file
If we want to create a dynamic website without a database, we can use JSON files as a substitute. It may sound strange, but let me explain. We will use .json files as a database for our projects because JSON is a widely used format for storing content outside of programs. We will create lists inside JSON files and use the Python module named json
(which is pre-installed with Python). You can import it with this code:
After importing the json module, you can use this code to create a JSON file. You can also manually create a JSON file using Explorer.
Now we will create a flask app and assign a route to it.
Now Let’s create a Example HTML File and Add a Form in It.
index.html
Make Sure to Keep HTML File Inside “Templates” Folder (Create a Folder and name it “Templates” Where the Python File is Stored).
After that, we will write three keys and create blank list in the place of values for storing data in Our Json File.
filename.json
Now We will Handle the Backend in Our Python File.
Main.py
Now if you Run the Python File and then go to http://127.0.0.1:5000/ in your Browser, you will see the HTML Page.

After that, When You Fill All Details and Then Click On Submit Button then Your Details Will be Stored in the .json File.
Webpage

filename.json

So, now you’ve learned how to store data dynamically in a JSON file from an HTML webpage. Next, let’s move on to getting data from JSON files into an HTML file.
We will create a sample HTML file for demonstration.
Reading from the JSON file
main.html
Make Sure to Also Put this HTML File Inside the Templates Folder!
Now we will create a new route in our Python file and serve the HTML page with data (Name, Email, Password) fetched from the JSON file.
Main.py
Now, when you go to http://localhost:5000/show-data
, you will see all the names, emails, and passwords that you filled in using the main page (index.html
).
Webpage

If you fill in more information on the main page, then more information will be shown before the webpage is automated by a for loop.
So, now you’ve learned how to store and fetch data from a JSON file. We hope you found this useful. Thanks for reading! 🙂