This is a web-based admin panel built using Flask, designed to manage brands and manufacturers. It includes CRUD (Create, Read, Update, Delete) functionality, authentication, and more. The application is styled for a modern look and provides a user-friendly interface.
- User authentication and authorization using Flask-Login.
- CRUD operations for Brands and Manufacturers.
- Dynamic and responsive design.
- Flash messages for better user feedback.
- Separate login routes for client and admin users.
- Admin-only access to certain features.
- Python 3.8+
- Poetry (for dependency management)
- Docker (optional, for containerization)
git clone https://github.com/k4rimdev/Flask-Metakam.git
cd Flask-Metakam
poetry install
Create a .env
file in the root directory and add the following configuration:
SECRET_KEY=your_secret_key
SQLALCHEMY_DATABASE_URI=sqlite:///app.db # or use PostgreSQL/MySQL URI
FLASK_ENV=development
Modify the config.py
file if you need to customize the settings further:
- SECRET_KEY: Security key for encryption and sessions.
- SQLALCHEMY_DATABASE_URI: Database connection string.
- FLASK_ENV: Set to
development
orproduction
.
Running the Application
poetry run flask db upgrade # Set up the database
poetry run flask run # Start the server
Navigate to http://127.0.0.1:5000
in your browser.
You need to create an admin user to access the admin panel:
from app import create_app, db
from app.controllers.user_controller import UserController
app = create_app()
with app.app_context():
UserController.add_user('admin', 'adminpassword')
GET /brands
- List all brandsPOST /brands
- Add a new brandGET /brands/edit/<id>
- Edit a specific brandPOST /brands/delete/<id>
- Delete a brand
GET /manufacturers
- List all manufacturersPOST /manufacturers
- Add a new manufacturerGET /manufacturers/edit/<id>
- Edit a specific manufacturerPOST /manufacturers/delete/<id>
- Delete a manufacturer
The admin panel can be accessed at http://127.0.0.1:5000/admin_client/brands
and http://127.0.0.1:5000/admin_client/manufacturers
. This requires login authentication.
To access the admin panel, log in with the credentials created during the setup. If not logged in, the application will redirect you to the login page.
For any questions or feedback, please reach out at:
Email: karimmirzaguliyev@gmail.com LinkedIn: Karim Mirzaguliyev