A comprehensive multi-tenant Django platform for hosting distinct web applications under a unified domain structure with subdomain-based routing.
MetaTask (formerly Mediap) is designed to host multiple related web applications under a single organizational domain. The platform features:
- Subdomain-based routing using django-hosts
- Multi-tenant architecture with organization-level data segregation
- Custom authentication with email-based login
- Modular app structure allowing independent but integrated applications
The project uses django-hosts to route traffic to different Django applications:
- Main Host (
metatask.orgorwww.metatask.org): Landing page, authentication flows (/login/,/register/) - Sub-Hosts (e.g.,
cflows.metatask.org): Dedicated application instances
All business data is isolated by Organization:
- Each
Accountbelongs to oneOrganization - Business models (e.g.,
Carin CFlows) link toOrganizationviaForeignKey - Views filter data strictly by the user's organization
The accounts app provides a custom Account model:
- Extends
AbstractBaseUser - Uses email as the primary identifier (no username)
- Linked to
OrganizationviaForeignKey(related_name='members')
MetaTask/
├── accounts/ # Custom user & authentication
│ ├── models.py # Account, Organization models
│ ├── views.py # login, logout, register views
│ ├── forms.py # Registration & auth forms
│ └── urls.py # Auth URL patterns
├── cflows/ # Car management application
│ ├── models.py # Car model (multi-tenant)
│ ├── views.py # CRUD views
│ └── urls.py # CFlows URL patterns
├── home/ # Main landing page app
│ ├── views.py # Home views
│ └── urls.py # Home URL patterns
├── Mediap/ # Project settings & configuration
│ ├── settings.py # Django settings
│ ├── hosts.py # django-hosts configuration
│ ├── urls.py # Root URL configuration
│ └── wsgi.py # WSGI application
├── templates/ # Global templates
│ └── base.html # Base template with navigation
├── manage.py # Django management script
├── requirements.txt # Python dependencies
└── README.md # This file
- Python 3.12+
- pip
- Virtual environment (recommended)
- Clone the repository
git clone https://github.com/yourusername/MetaTask.git
cd MetaTask- Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Apply migrations
python manage.py makemigrations
python manage.py migrate- Create a superuser
python manage.py createsuperuser- Run the development server
python manage.py runserver- Access the application
- Main site: http://127.0.0.1:8000
- Admin panel: http://127.0.0.1:8000/admin
Edit Mediap/settings.py for:
SECRET_KEY: Django secret key (change in production!)DEBUG: Set toFalsein productionALLOWED_HOSTS: Add your domain namesAUTH_USER_MODEL: Points to'accounts.Account'
See Mediap/hosts.py for subdomain routing rules:
host_patterns = [
host(r'www', 'home.urls', name='www'),
host(r'cflows', 'cflows.urls', name='cflows'),
# Add more subdomains here
]- Django 5.2.7: Web framework
- django-hosts: Subdomain routing
- Pillow: Image handling (if using ImageFields)
- pytest & pytest-django: Testing framework
See requirements.txt for the complete list.
Run tests with pytest:
pytestRun Django's system checks:
python manage.py checkCurrently using SQLite (db.sqlite3) for development. For production, configure PostgreSQL or MySQL in Mediap/settings.py.
Authentication is handled by the accounts app:
- Registration:
/register/ - Login:
/login/ - Logout:
/logout/
All authentication URLs are served from the main host.
Landing page and general information served at the root domain.
Car fleet management application:
- Accessible at
cflows.metatask.org - Multi-tenant: data filtered by organization
- CRUD operations for vehicles
User and organization management:
- Custom
Accountmodel Organizationmodel for multi-tenancy- Authentication views and forms
- Old Project Name: Some references to "Mediap" may still exist in the codebase
- Multi-tenancy: Always filter queries by
request.user.organization - Testing: Test files include
home/tests_hello.py, use pytest for running tests
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Project Link: https://github.com/yourusername/MetaTask
- Django Framework
- django-hosts for subdomain routing
- All contributors to the project