A modular Flask application with Flask-SQLAlchemy, Flask-Migrate, Flask-Babel, and Flask-Login.
mon3y_clone/
├── app/
│ ├── __init__.py # Application factory
│ ├── extensions.py # Flask extensions
│ ├── main/ # Main blueprint
│ │ ├── __init__.py
│ │ └── routes.py # Main routes
│ └── translations/ # Babel translations directory
├── config.py # Configuration classes
├── run.py # Application entry point
├── .env # Environment variables
├── requirements.txt # Python dependencies
└── README.md # This file
git clone <repository-url>
cd mon3y_clone
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
.env file with your configuration:
SECRET_KEY=your-secret-key-here
FLASK_ENV=development
SQLALCHEMY_DATABASE_URI=sqlite:///dev-database.db
BABEL_DEFAULT_LOCALE=en
BABEL_SUPPORTED_LOCALES=en,es,fr,pt,de
flask db init
flask db migrate -m "Initial migration"
flask db upgrade
# Extract translatable strings
pybabel extract -F babel.cfg -o messages.pot .
# Initialize translations for each language
pybabel init -i messages.pot -d app/translations -l es
pybabel init -i messages.pot -d app/translations -l fr
pybabel init -i messages.pot -d app/translations -l pt
pybabel init -i messages.pot -d app/translations -l de
# Compile translations
pybabel compile -d app/translations
Development mode:
python run.py
Or using Flask CLI:
export FLASK_APP=run.py
flask run
The application will be available at http://localhost:5000
The application supports two configurations:
Set the configuration in .env:
FLASK_ENV=development # or production
Database ORM for managing database models and queries.
Database migrations using Alembic.
Internationalization and localization support.
Supported languages:
User session management and authentication.
app/:
mkdir app/new_blueprint
__init__.py:
from flask import Blueprint
bp = Blueprint('new_blueprint', __name__)
from app.new_blueprint import routes
Create routes.py with your routes
app/__init__.py:
from app.new_blueprint import bp as new_bp
app.register_blueprint(new_bp, url_prefix='/new')
Create models in a new file app/models.py:
from app.extensions import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
# Create a new migration
flask db migrate -m "Description of changes"
# Apply migrations
flask db upgrade
# Rollback migrations
flask db downgrade
This project is licensed under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.