Skip to content

omar-2004/Blog-using-flask

Repository files navigation

CodeRabbit Pull Request Reviews Code Review

📚 Flask Full-Stack Application Template

Welcome to the Flask Full-Stack Application Template, an open-source project designed for learning, experimentation, and rapid prototyping. This project provides a modular and scalable structure for building Flask applications that incorporate both front-end and back-end components. It can serve as a starting point for various types of applications or simply as a reference for studying Flask best practices.

⚠️ Disclaimer: This project is provided as-is and is intended for educational purposes. It is not production-ready, and you should use it at your own responsibility. Contributions, feedback, and adaptations are welcome!


🚀 Features

  • 📦 Modular Structure: Easily extendable using Flask Blueprints.
  • 🌐 Front-End Ready: Supports Jinja2 templating with organized static files (CSS, JS, images).
  • 🛠️ Database Integration: SQLAlchemy ORM with Flask-Migrate for database migrations.
  • 📝 Forms Handling: WTForms integration for form validation and rendering.
  • 🧪 Testing Ready: Basic test setup for unit and integration testing.
  • ♻️ App Factory Pattern: Flexible application creation suitable for multiple environments.

📂 Project Structure

/my_flask_app
│
├── /app                  # Application package
│   ├── /static           # Static files (CSS, JS, images)
│   ├── /templates        # Jinja2 templates (HTML files)
│   ├── /blueprints       # Modular blueprints (user, blog, auth, etc.)
│   ├── /extensions.py    # Initialize extensions
│   ├── /models.py        # App-wide database models
│   ├── /forms.py         # App-wide forms
│   ├── /routes.py        # App-wide routes
│   ├── /utils.py         # Utility functions
│   └── __init__.py       # App factory function
│
├── /migrations           # Database migrations
├── /tests                # Unit & integration tests
├── .env                  # Environment variables
├── .flaskenv             # Flask environment settings
├── requirements.txt      # Python dependencies
├── config.py             # Configuration settings
├── run.py                # Application entry point
└── README.md             # Documentation (this file)

Getting Started

1️⃣ Clone the Repository

git clone https://github.com/omar-2004/Blog-using-flask
cd Blog-using-flask

2️⃣ Create a Virtual Environment

python -m venv venv
source venv/bin/activate  # On Windows: venv\\Scripts\\activate

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Configure Environment Variables

Create a .env file in the root:

SECRET_KEY=your_secret_key
DATABASE_URL=sqlite:///app.db

5️⃣ Set Up Database

flask db init
flask db migrate -m "Initial migration."
flask db upgrade

6️⃣ Run the Application

flask run

Access the app at: http://localhost:5000


💡 Usage

This template can be used for:

  • 📚 Learning Flask: Explore Flask’s structure, extensions, and patterns.
  • 🧪 Experimentation: Add new blueprints, models, or features to practice your skills.
  • 🚀 Starter Template: Use it as a base for your own Flask projects.

💬 Note: The app is not optimized for production usage. For deployment, consider using a WSGI server like Gunicorn and a web server like Nginx.


🧪 Running Tests

Basic tests are provided in the /tests directory.

python -m unittest discover tests

🌟 Contributing

Contributions are welcome! Feel free to fork the project, create new branches, and submit pull requests. If you encounter issues or have ideas for improvements, open an issue!


⚠️ License & Responsibility

This project is open source and distributed under the MIT License. However, it is intended for learning purposes only. Use it at your own responsibility, especially if adapting it for real-world applications.

DISCLAIMER: The maintainers are not responsible for any issues, security flaws, or data losses resulting from the use of this code.


🙌 Acknowledgements


🎉 Happy coding and happy learning! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published