A beginner-friendly Flask project that demonstrates:
- Multi-page routing
- Template inheritance with Jinja2
- Form handling (GET & POST)
- Basic CSS styling
- In-memory data storage
This is Part 3 of a tutorial series on building web apps with Flask.
- 🏠 Home Page – A welcome message
- 📖 Guestbook Page – Users can leave their name and a message
- 🎨 Styled UI – Uses
static/style.css
for basic formatting - 🔄 Reset Route – Clears all guestbook entries for testing
flask-guestbook/
├── app.py # Main Flask application
├── static/ # Static files (CSS, JS, images)
│ └── style.css # Styling for form and layout
└── templates/ # Jinja2 HTML templates
│ └── base.html # Shared base template
│ └── home.html # Home page content
│ └── guestbook.html # Guestbook form and entries
-
Routes:
/
– Home/guestbook
– View and submit entries/reset
– (Bonus) Clears all messages
-
Templates:
base.html
provides the layout- Other pages extend
base.html
using{% extends %}
-
Styling:
- Basic form and navigation styling in
style.css
- Basic form and navigation styling in
pip install Flask
python app.py
Go to http://127.0.0.1:5000
✅ Clean template structure
✅ Dynamic routing with url_for
✅ Form validation with required fields
✅ Auto-redirect on submission to prevent resubmission
✅ Reset functionality for demo/testing
Connect to SQLite or another database
Add user sessions and flash messages
Deploy to Heroku or Render
MIT – Free to use, modify, and distribute.
Made with ❤️ by Ajita Gupta
Follow the tutorial series on Medium