A Flask-based blog platform for learning and teaching the Catalan language.
learn-catalan is a blog-style language learning platform built with Flask and SQLAlchemy. It provides a clean, database-backed environment where Catalan language learners can access blog posts, lessons, vocabulary articles, and cultural content organized chronologically and by topic.
- Blog posts and articles for Catalan language learning
- Structured lessons organized by topic
- Database-driven content management
- Chronological and category-based post navigation
- User-friendly web interface
- Production-ready deployment configuration
- Database migrations for schema management
- Backend: Python 3, Flask, Flask-SQLAlchemy
- Frontend: HTML5, CSS3
- Database: SQLAlchemy ORM with Alembic migrations
- Deployment: WSGI-compatible (Procfile included for Heroku)
- Python 3.7+
- pip
- Clone the repository:
git clone https://github.com/Andriy-Rudyi/learn-catalan.git
cd learn-catalan- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Initialize the database:
flask db upgrade- Run the application:
python run.pyThe application will be available at http://localhost:5000
learn-catalan/
├── flaskblog/ # Main Flask blog application package
│ ├── __init__.py # Flask app initialization
│ ├── models.py # Blog post and user models
│ ├── routes.py # Blog routes (posts, categories, etc.)
│ └── templates/ # HTML blog templates
│ └── static/ # CSS, JavaScript, assets
├── migrations/ # Database migrations
├── run.py # Application entry point
├── requirements.txt # Python dependencies
├── Procfile # Deployment configuration
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
└── README.md # This file
Start the development server:
python run.pyCreate a new migration after model changes:
flask db migrate -m "Description of changes"
flask db upgradeUse a production WSGI server like Gunicorn:
gunicorn run:appFor Heroku deployment, the Procfile is already configured.
Environment variables can be set in a .env file or system environment:
FLASK_ENV=production
FLASK_APP=run.py
DATABASE_URL=postgresql://user:password@localhost/learn_catalan
SECRET_KEY=your-secret-key-hereThe application uses SQLAlchemy as the ORM with Alembic for migrations. Database schema is version-controlled in the migrations/ directory.
To reset the database:
flask db downgrade base
flask db upgradeheroku create your-app-name
git push heroku dev:main
heroku run flask db upgradeCreate a Dockerfile for containerized deployment. Ensure the Flask app is properly configured for the container environment.
- Ensure Python and pip are installed
- Install dependencies:
pip install -r requirements.txt - Run migrations:
flask db upgrade - Start with Gunicorn or similar WSGI server
Workspace configuration is included in .vscode/. Recommended extensions:
- Python
- Flask Snippets
- SQLAlchemy
Follow PEP 8 standards. Consider using:
blackfor code formattingflake8for lintingmypyfor type checking
- Create a feature branch:
git checkout -b feature/description - Make your changes and commit:
git commit -m 'Add feature' - Push to the branch:
git push origin feature/description - Open a pull request
ImportError when running the app:
# Ensure virtual environment is activated
source venv/bin/activate
pip install -r requirements.txtDatabase migration errors:
# Check migration history
flask db current
flask db history
# Rollback if needed
flask db downgrade -1Port already in use:
# Change the port in run.py or use
python run.py --port 5001This project is licensed under the MIT License. See the LICENSE file for details.
For issues, questions, or suggestions, open an issue on GitHub.
Last updated: March 2026