Thanks to visit codestin.com
Credit goes to github.com

Skip to content

This repository is a structured Flask learning series

1608Suraj/Flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Flask Repo

This repository contains simple Flask examples demonstrating basic routing, string manipulation, number checking, and HTML template rendering for eligibility checking.


📁 Repository Structure

Flask/
├── first.py                # Day 1 Flask app (basic routes)
├── Interview.md           # Q&A document for Flask/Python interview prep
├── app.py       # Day 2 Flask app (eligibility check with templates)
├── templates/
│   ├── eligible.html       # Template for eligible users
│   └── noteligible.html    # Template for not eligible users
└── README.md              # This file

🔖 Day 1 — Basic Flask Routes

🚀 Features Implemented

  • Root route (/) → returns Hello, World!
  • Reverse string route (/reverse/<string:text>) → returns original and reversed string
  • Armstrong number checker (/check/<int:num>) → checks if a number is an Armstrong number

▶️ Run Instructions

# Navigate into repo
cd Flask  

# Install dependencies
pip install flask  

# Run Day 1 app
python first.py

App runs on: http://127.0.0.1:5000

🌐 Routes Summary

Route Method Purpose
/ GET Returns "Hello, World!"
/reverse/<string:text> GET Returns original + reversed string (/reverse/helloolleh)
/check/<int:num> GET Checks if number is Armstrong (/check/153 → Armstrong number message)

🔖 Day 2 — Eligibility Check with Templates

📚 Learning (Step-up from Day 1)

  • Learned how to use Flask’s render_template() to connect Python with HTML
  • Introduced Jinja2 templating to dynamically display variables ({{ age }}) in HTML
  • Applied separation of logic and presentation (Python logic in .py, UI in .html)
  • Understood conditional rendering (eligible vs not eligible)

Eligible Page Not Eligible Page

🚀 Features Implemented

  • Root route (/) → simple welcome message
  • Age route (/age/<int:age>) → checks if a person is eligible or not eligible
  • Uses Jinja2 templates (eligible.html and noteligible.html) for styled output

▶️ Run Instructions

# Navigate into repo
cd Flask  

# Run Day 2 app
python app.py

App runs on: http://127.0.0.1:5000

🌐 Routes Summary

Route Method Purpose
/ GET Returns a welcome message with instructions
/age/<int:age> GET Renders an HTML page showing whether the person is Eligible / NotEligible

🧰 Notes

  • Both apps run in debug mode (debug=True) for auto-reload and detailed error messages.
  • Day 1 demonstrates basic routing & string/number logic.
  • Day 2 introduces Flask template rendering (HTML with Jinja2 variables).

✅ Contributing

Feel free to:

  • Add new routes / examples
  • Improve templates & UI
  • Suggest enhancements via fork & pull request

About

This repository is a structured Flask learning series

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published