Planta Milenio uses three database connections simultaneously: a local SQLite file that stores application users and audit logs, and two Microsoft SQL Server databases that hold plant operations data. The SQLite database is fully managed by Django migrations, while the SQL Server databases are accessed via raw SQL queries and stored procedures without any migration involvement.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JuanDiego3030/Planta_Milenio/llms.txt
Use this file to discover all available pages before exploring further.
Local SQLite database (default)
The default connection uses Django’s built-in SQLite backend and requires no additional configuration beyond what is already in proyecto/settings.py. It stores the following application models:
User_admin— application user accounts created byCreateUser.pyHistorial— activity log entriesAccesoPersona— personnel access records
planta.sqlite3 is written to the project root directory on first migration. To create the schema, activate your virtual environment and run:
SQL Server connections
Both SQL Server databases use themssql engine provided by mssql-django, which communicates with the server through pyodbc and the FreeTDS ODBC driver. The complete DATABASES configuration in proyecto/settings.py looks like this:
<password> and <sql-server-host> with the actual credentials and hostname or IP address for each server. Both connections authenticate as the profit SQL Server login and communicate over port 1433.
mssql-django 1.6 — the version pinned in requirements.txt — adds Django 5.1 and 5.2 support. Use this version or newer when running Planta Milenio on Django 5.x.Installing FreeTDS on Linux
FreeTDS provides the ODBC driver entry referenced as'driver': 'FreeTDS' in the OPTIONS dictionary. Install the required system packages on Ubuntu or Debian:
profit credentials are accepted:
1> prompt. Type quit to exit. If the connection is refused, check that port 1433 is open in the server’s firewall and that the TDS version 7.4 is supported by the target SQL Server instance (SQL Server 2012 and later).
Installing the Microsoft ODBC Driver on Windows
On Windows, replace the FreeTDS driver with Microsoft’s native ODBC driver. Install ODBC Driver 17 for SQL Server (or a later version) following the official Microsoft installation guide. After installation, update thedriver key in both SQL Server OPTIONS dictionaries:
tds_version key, as it is specific to FreeTDS and has no meaning for the Microsoft driver.
Required stored procedures on ceres_romana
The application calls two stored procedures in the Ceres Romana database. These procedures must exist and be executable by the profit login before the transport registration and audit editing workflows will function:
dbo.Orden_Profit_Transporte_Insert— invoked when registering a new transport entrydbo.Orden_Profit_Transporte_Update— invoked when editing an existing audit record
profit user has EXECUTE permission on them.
Verifying connectivity
After configuring credentials and installing the driver, confirm that Django can actually reach each SQL Server database. Open the Django shell:ceres_romana connection:
connections['sqlserver'] and an appropriate table name to verify the AGRBSS_A connection in the same way.