The Problem I Set Out to Solve
Managing a gym involves three completely different sets of people with completely different needs: admins who oversee everything, trainers who manage their members, and members who just want to track their progress. Most gym software either costs a fortune or forces everyone into the same generic interface.
I decided to build FitnessPro — a complete gym management system that gives each user type exactly what they need.
Designing the Multi-Role Architecture
The key challenge in any multi-role system is access control. Django's built-in authentication system gives you users and groups, but you still need to think carefully about how to structure permissions.
# I used a custom user model with a role field
class User(AbstractUser):
ROLES = [
('admin', 'Admin'),
('trainer', 'Trainer'),
('member', 'Member'),
]
role = models.CharField(max_length=20, choices=ROLES, default='member')Each role gets its own set of views, templates, and URL namespaces. A custom middleware redirects users to their appropriate dashboard on login.
The Core Modules
Membership Management: Members can have different membership tiers (Basic, Premium, VIP) with different durations. I built a system that automatically tracks expiry dates and sends renewal reminders.
Attendance Tracking: Trainers can mark attendance for their members. The admin dashboard shows attendance trends across the entire gym.
Workout & Diet Plans: Trainers create personalised plans and assign them to specific members. Members see their plans in a clean, readable format.
Deployment on PythonAnywhere
PythonAnywhere is excellent for Django apps — it handles WSGI configuration, static files, and gives you a free subdomain. The deployment process is straightforward once you understand how to configure your wsgi.py file and set up your virtual environment.
Key Lessons
- Plan your data models first. I spent a full day designing the database schema before writing any views, and it saved me from countless refactors.
- Django's admin is a superpower. With a bit of customisation, the admin interface becomes a fully functional back-office for non-technical staff.
- Role-based access control should be centralised. A custom permission mixin on your views is much better than checking
request.user.rolein every view.
The full source code is on GitHub and the live demo is at fitnesspro.pythonanywhere.com.