Integrating Third-Party Software in Horilla HRMS Using Django Multiple Databases
When building a real HR system like Horilla HRMS, one thing becomes clear very quickly:
Most companies are already using other tools.
It could be:
- A biometric attendance system
- A payroll software
- An old HR system that they don’t want to replace immediately
- etc…
So the question is not “Should we integrate?”
It’s actually:
“How do we connect Horilla with what already exists?”
The Reality You Should Know First
Django does support multiple databases.
But it does not automatically integrate them.
There is:
- No auto-sync between databases
- No automatic relationship handling
- No cross-database joins
So if you connect another database, Django will not magically merge everything for you.
And honestly, that’s okay.
Because it gives you full control.
The Core Idea
Think of Django not as the one doing the integration,
But as the orchestrator.
You connect different databases, and then:
You decide how data flows between them
Step 1: Connect the External System
Let’s say a company is using a biometric system.
You can simply connect its database in Horilla HRMS or Django settings.py:
DATABASES = {
'default': {...}, # Horilla database
'biometric_db': {...}, # External system
}
At this point, nothing is integrated yet.
You just have access.
Step 2: Read Data from That System
You can map the external table and read from it.
logs = BiometricLog.objects.using('biometric_db').all()
Now Horilla can see the data.
But still…
No syncing is happening automatically.
Many expect something like:
- “Django will auto import logs.”
- “It will match employees automatically”
- “It will keep both databases in sync”
None of this exists by default.
So What Do We Do Instead?
We built a simple flow ourselves.
Think of it like this:
Read → Clean → Save
A Real Horilla Example (Biometric Integration)
- Let’s keep it very practical.
- A company is using a biometric device that stores attendance in its own database.
- We want that data inside Horilla.
Step 1: Read Logs
logs = BiometricLog.objects.using('biometric_db').all()
Step 2: Match Employees
The biometric system might use a different ID.
So we map it:
employee = Employee.objects.get(badge_id=log.emp_code)
Step 3: Save into Horilla
Attendance.objects.create(
employee_id=employee,
check_in=log.punch_time,
...
)
Step 4: Repeat Automatically
Since Django won’t do it, we schedule it.
Options:
- Cron job
- Background worker
- Django command
For example:
python manage.py sync_attendance #custom management command
Now you have your own integration system.
Why This Approach Actually Works Well
At first, it may feel like extra work.
But in real projects, this gives you flexibility.
You can:
- Work with any database
- Handle messy data properly
- Control when and how syncing happens
And most importantly:
You are not dependent on third-party APIs
Another Simple Scenario: Payroll System
Let’s say payroll is handled by another software.
Instead of replacing it, you can:
Send attendance and leave data from Horilla
Let the payroll system calculate the salary
Read the final results back into Horilla
Again, no automation from Django.
But completely doable with a simple sync process.
A Small but Important Tip
Always treat external databases carefully.
Don’t assume the data is clean.
Don’t directly depend on their structure
Try to keep it read-only if possible.
And always add some logging so you know:
- What was synced
- What failed
- When Should You Use This Approach?
This works best when:
- There is no API available
- The system is old but still important
- You need real-time or frequent data access
- You want to avoid manual imports
If a clean API already exists, that might be easier.
But in many real-world setups…
Database access is the only reliable option.
Conclusion
Django doesn’t give you automatic multi-database integration.
But it gives you something better:
The ability to build your own integration, exactly the way you need it
For Horilla, this means:
You can plug into existing systems
You don’t need to force companies to switch tools
You can grow step by step instead of replacing everything
And that’s what makes it practical in real environments.
