A Python Flask web application with admin panel, REST API, and multi-language support for managing landing pages.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
- Admin Panel: Web-based administration interface
- REST API: Full API endpoints for frontend integration
- Multi-language Support: Supports Turkmen (tk), English (en), and Russian (ru)
- Caching: Redis-based caching for improved performance
- Session Management: Redis session storage
- Database Support: PostgreSQL and MSSQL support
- Security: CSRF protection, user authentication
- Performance: HTML minification, compression, CORS support
! If images are local, change url to:
"file_path": "/static/web/assets/img/ugurly_yol/worker1.png"
The fastest way to get started:
# Clone the repository
git clone git@github.com:mikebionic/landing_admin.git
cd landing-admin
# Copy environment file
cp .env.example .env
# Edit .env with your settings (optional - defaults work for development)
nano .env
# Start the application
make docker-upThe application will be available at http://localhost:8000
- Python 3.8+
- PostgreSQL 12+
- Redis (optional, but recommended)
-
Clone and setup
git clone <your-repo-url> cd landing-admin python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Database Setup
# Create PostgreSQL database createdb landing_admin # Or connect to PostgreSQL and run: # CREATE DATABASE landing_admin;
-
Configuration
cp .env.example .env # Edit .env with your database credentials and other settings -
Create required directories
mkdir -p static/uploads
-
Database Migration
# Copy migration config cp example.migration.json app.migration.json # Edit app.migration.json as needed # Run migrations (if available) flask db upgrade
-
Run the application
python app.py
Key environment variables in .env:
APP_PORT: Port to run the application (default: 8000)APP_HOST: Host address (default: 0.0.0.0)SECRET_KEY: Flask secret key for sessionsDEBUG: Enable debug mode (1/0)
DB_TYPE: Database type (postgres/mssql)DB_USERNAME: Database usernameDB_PASSWORD: Database passwordDB_DATABASE: Database nameDB_HOST: Database hostDB_PORT: Database port
SESSION_REDIS: Redis URL for sessionsCACHE_REDIS_URL: Redis URL for cachingCACHE_TYPE: Cache type (simple/redis)
USE_FLASK_CORS: Enable CORS (1/0)USE_FLASK_COMPRESS: Enable compression (1/0)BABEL_DEFAULT_LOCALE: Default language (tk/en/ru)
# Development
make install # Install dependencies
make run # Run development server
make test # Run tests (if available)
# Docker operations
make docker-build # Build Docker image
make docker-up # Start with docker-compose
make docker-down # Stop docker-compose
make docker-logs # View logs
make docker-shell # Access container shell
# Database operations
make db-init # Initialize database
make db-migrate # Run migrations
make db-reset # Reset database
# Utilities
make clean # Clean temporary files
make lint # Run code linting
make format # Format codeThe application provides REST API endpoints under /api prefix:
GET /api/auth/get-images/- Get Images'GET /api/auth/get-pages/- Get Pages'
- Admin panel available at
/admin/login - Web interface at
/
- Switch language:
GET /set_language/<code> - Supported codes:
tk,en,ru
landing-admin/
├── app.py # Application entry point
├── main/
│ ├── __init__.py # App factory and configuration
│ ├── config.py # Configuration settings
│ ├── models.py # Database models
│ ├── languageMethods.py # Language utilities
│ ├── admin/ # Admin blueprint
│ ├── web/ # Web blueprint
│ ├── api/ # API blueprint
│ ├── static/ # Static files
│ └── templates/ # Jinja2 templates
├── static/
│ └── uploads/ # Upload directory
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose setup
├── Makefile # Development commands
└── .env # Environment variables
- Models: Add database models in
main/models.py - Routes: Create routes in appropriate blueprint (
admin,web,api) - Templates: Add Jinja2 templates in
main/templates - Static Files: Add CSS/JS/images in
main/static
The application uses Flask-Babel for internationalization:
-
Mark strings for translation:
from flask_babel import gettext, lazy_gettext message = gettext('Hello World')
-
Extract messages:
pybabel extract -F babel.cfg -k _l -o messages.pot . -
Update translations:
pybabel update -i messages.pot -d translations
Use SQLAlchemy for database operations:
from main import db
from main.models import YourModel
# Create
item = YourModel(name='example')
db.session.add(item)
db.session.commit()
# Query
items = YourModel.query.all()-
Using Docker (Recommended):
# Production build docker-compose -f docker-compose.prod.yml up -d -
Manual Deployment:
# Use a production WSGI server pip install gunicorn gunicorn -w 4 -b 0.0.0.0:8000 app:app
Set these additional variables for production:
DEBUG=0
TESTING=0
SECRET_KEY=your-super-secret-key
FLASK_ENV=production-
Database Connection Error:
- Check database credentials in
.env - Ensure PostgreSQL is running
- Verify database exists
- Check database credentials in
-
Redis Connection Error:
- Install and start Redis server
- Or set
SESSION_TYPE=filesystemin.env
-
Permission Errors:
- Ensure
static/uploadsdirectory exists - Check file permissions
- Ensure
-
Import Errors:
- Activate virtual environment
- Install requirements:
pip install -r requirements.txt
View application logs:
# Docker
make docker-logs
# Manual
tail -f app.log- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make changes and test
- Commit:
git commit -am 'Add feature' - Push:
git push origin feature-name - Create Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project is perfect for:
- Landing Pages: Create database-driven landing pages with admin control
- Multi-language Websites: Built-in support for Turkmen, English, and Russian
- Content Management: Administrators can update content without code changes
- API-driven Frontends: REST API for modern frontend frameworks
- Small Business Websites: Simple admin panel for non-technical users
Legacy Notice: This project was created in 2021 and uses some older dependencies. While fully functional, consider upgrading packages for production use. It serves as an excellent reference or starting point for similar projects.
For support and questions:
- Create an issue on GitHub
- Check the troubleshooting section
- Review environment configuration
Good luck in development! 🚀








