A professional Flask-based website for YallaIoT, featuring a blog system, contact management, and newsletter subscription functionality.
- Dynamic Blog System: Paginated blog posts with individual post pages
- Newsletter Subscription: Email collection system for newsletter subscribers
- Contact Management: Contact form with message storage in SQLite database
- SEO Optimized: Built-in sitemap.xml and robots.txt for search engine optimization
- Responsive Design: Modern, mobile-friendly interface
- Error Handling: Custom 404 error pages
- Python 3.11 or higher
- pip (Python package installer)
- SQLite3
-
Clone the repository
git clone https://github.com/mhammadzahi/website.git cd website -
Create a virtual environment
python3 -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up the database
Ensure you have a
database.dbfile with the following tables:posts(id, slug, title, content, created_at, etc.)newsletter_subscribers(id, email, created_at)contact_messages(id, full_name, email_address, subject, message, created_at)
python app.pyThe application will run on http://localhost:5000 with debug mode enabled.
gunicorn -w 4 -b 0.0.0.0:5000 app:appOptions:
-w 4: Number of worker processes (adjust based on CPU cores)-b 0.0.0.0:5000: Bind to all interfaces on port 5000--access-logfile -: Log access requests to stdout--error-logfile -: Log errors to stdout
Recommended production command:
gunicorn -w 4 -b 0.0.0.0:5000 --access-logfile - --error-logfile - app:appwebsite/
├── app.py # Main Flask application
├── database.db # SQLite database
├── requirements.txt # Python dependencies
├── robots.txt # Search engine crawler rules
├── functions/
│ └── database.py # Database operations
├── static/
│ ├── css/
│ │ └── style.css # Stylesheets
│ ├── img/ # Images and media
│ └── js/
│ └── script.js # JavaScript files
└── templates/
├── base.html # Base template
├── index.html # Homepage
├── about.html # About page
├── services.html # Services page
├── blog.html # Blog listing page
├── post.html # Individual post page
├── contact.html # Contact page
├── terms.html # Terms and conditions
└── 404.html # Error page
GET /- HomepageGET /about- About pageGET /services- Services pageGET /blog- Blog listing (paginated)GET /blog/page/<int:page>- Blog paginationGET /post/<slug>- Individual blog postGET /contact- Contact pagePOST /contact- Submit contact formGET /terms- Terms and conditionsGET /sitemap.xml- XML sitemap for SEOGET /robots.txt- Robots.txt for search engines
POST /api/newsletter/subscribe- Subscribe to newsletter
Request body:
{
"email": "user@example.com"
}The database path is configured in functions/database.py:
DB_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'database.db')Update the domain in the following locations:
app.py- sitemap.xml generation (line ~106)robots.txt- Sitemap URL
- API endpoints blocked from search engine crawling
- Static assets protection in robots.txt
- Database files excluded from public access
- Environment files protected
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is proprietary and confidential.
Mohammad Hammadzahi
- GitHub: @mhammadzahi
- Website: yallaiot.com
Found a bug? Please open an issue on GitHub with detailed information about the problem.
Built with ❤️ using Flask