fd493f13e9b5792e4219bb2555ed137421953cf4
Finger Web Flask Application
A simple, modern Flask web application demonstrating basic web development concepts with clean code structure, responsive design, and best practices.
🚀 Features
- Multiple Routes: Home, About, Contact pages with clean navigation
- Contact Form: Functional contact form with validation and flash messages
- JSON API: RESTful API endpoints for data exchange
- Responsive Design: Mobile-first design using Bootstrap 5
- Error Handling: Custom 404 and 500 error pages
- Modern UI: Clean, professional interface with animations
- Form Validation: Client-side and server-side validation
- Configuration Management: Environment-based configuration
📁 Project Structure
finger-web/
├── app.py # Main Flask application
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── .gitignore # Git ignore file
├── Dockerfile # Docker container configuration
├── .dockerignore # Docker ignore file
├── docker-compose.yml # Docker Compose configuration
├── templates/ # HTML templates
│ ├── base.html # Base template with navigation
│ ├── index.html # Home page
│ ├── about.html # About page
│ ├── contact.html # Contact form
│ ├── 404.html # 404 error page
│ └── 500.html # 500 error page
└── static/ # Static assets
├── css/
│ └── style.css # Custom styles
└── js/
└── main.js # JavaScript functionality
🛠️ Technologies Used
Backend
- Python 3.x - Programming language
- Flask 2.3.3 - Web framework
- Jinja2 - Template engine
- Werkzeug - WSGI toolkit
Frontend
- HTML5 - Markup language
- CSS3 - Styling with custom animations
- JavaScript (ES6+) - Interactive functionality
- Bootstrap 5.3 - CSS framework for responsive design
📋 Prerequisites
- Python 3.7 or higher
- pip (Python package installer)
- Virtual environment (recommended)
🚀 Installation & Setup
1. Clone or Download the Project
# If using git
git clone <repository-url>
cd finger-web
# Or download and extract the project files
2. Create Virtual Environment (Recommended)
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
3. Install Dependencies
pip install -r requirements.txt
4. Run the Application
python app.py
The application will start on http://localhost:5000
🌐 Available Routes
| Route | Method | Description |
|---|---|---|
/ |
GET | Home page |
/about |
GET | About page |
/contact |
GET, POST | Contact form |
/api/hello |
GET | Simple JSON API endpoint |
/api/info |
GET | Application information API |
🔧 Configuration
The application uses environment variables for configuration. You can set these in your environment or create a .env file:
# Flask Configuration
FLASK_DEBUG=True
SECRET_KEY=your-secret-key-here
# Database (for future use)
DATABASE_URL=sqlite:///app.db
# Mail Configuration (for future use)
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USE_TLS=True
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=your-app-password
📱 API Endpoints
GET /api/hello
Returns a simple greeting message.
Response:
{
"message": "Hello from Flask API!",
"status": "success",
"version": "1.0"
}
GET /api/info
Returns application information and available routes.
Response:
{
"app_name": "Finger Web Flask App",
"routes": ["/", "/about", "/contact", "/api/hello", "/api/info"],
"framework": "Flask"
}
🎨 Customization
Styling
- Edit
static/css/style.cssto customize the appearance - The app uses Bootstrap 5 classes for responsive design
- Custom CSS variables and animations are included
JavaScript
- Modify
static/js/main.jsfor additional functionality - Includes form validation, animations, and keyboard shortcuts
- API helper functions are available
Templates
- All HTML templates extend
templates/base.html - Use Jinja2 template syntax for dynamic content
- Bootstrap components are readily available
🔍 Features in Detail
Contact Form
- Client-side validation with real-time feedback
- Server-side validation and sanitization
- Flash messages for user feedback
- Form submission with loading states
Responsive Design
- Mobile-first approach
- Bootstrap grid system
- Custom breakpoints and animations
- Touch-friendly interface
Error Handling
- Custom 404 and 500 error pages
- Graceful error handling in routes
- User-friendly error messages
JavaScript Features
- Form validation and enhancement
- Smooth scrolling navigation
- Card animations on scroll
- Keyboard shortcuts (Alt+H, Alt+A, Alt+C)
- API interaction helpers
🚀 Deployment
Development
python app.py
Docker Deployment
Option 1: Using Docker directly
# Build the Docker image
docker build -t finger-web .
# Run the container
docker run -d -p 5000:5000 --name finger-web-app finger-web
Option 2: Using Docker Compose (Recommended)
# Build and start the application
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the application
docker-compose down
Docker Commands
# Build image
docker build -t finger-web .
# Run container with environment variables
docker run -d \
-p 5000:5000 \
-e FLASK_ENV=production \
-e SECRET_KEY=your-secret-key \
--name finger-web-app \
finger-web
# View container logs
docker logs finger-web-app
# Stop and remove container
docker stop finger-web-app
docker rm finger-web-app
Production
For production deployment, consider using:
- Docker for containerization (included)
- Docker Compose for orchestration (included)
- Gunicorn as WSGI server
- Nginx as reverse proxy
- Heroku, DigitalOcean, or AWS for hosting
Example with Gunicorn:
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app
🔒 Security Considerations
- Change the
SECRET_KEYin production - Use environment variables for sensitive data
- Enable HTTPS in production
- Implement rate limiting for forms
- Validate and sanitize all user inputs
🤝 Contributing
- Fork the project
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
📝 License
This project is open source and available under the MIT License.
📞 Support
If you encounter any issues or have questions:
- Check the existing documentation
- Review the code comments
- Test in a clean virtual environment
- Create an issue with detailed information
🎯 Future Enhancements
- Database integration with SQLAlchemy
- User authentication and sessions
- Email functionality for contact form
- Admin dashboard
- API rate limiting
- Unit tests
- CI/CD pipeline
- Kubernetes deployment manifests
- Monitoring and logging integration
Built with ❤️ using Flask and Bootstrap
Languages
Python
49.7%
HTML
20.9%
CSS
14.2%
JavaScript
13.2%
Dockerfile
2%