| ... | ... | @@ -10,7 +10,29 @@ The User interacts with the BMON applicaton through a web browser. The Django s |
|
|
|
|
|
|
|
## Details on Django Server Application
|
|
|
|
|
|
|
|
This section presents some further details on the Django Server application. In Django vocabulary, the BMON Django Project consists of one [[application|https://docs.djangoproject.com/en/1.8/ref/applications/]], the `bmsapp` application. Thus, the important code files for the application are found in the `bmon/bmsapp` directory.
|
|
|
|
This section presents some further details on the Django Server application. In Django vocabulary, the BMON Django Project consists of one [[application|https://docs.djangoproject.com/en/1.8/ref/applications/]], the `bmsapp` application. Thus, the important code files for the application are found in the `bmon/bmsapp` directory. Here is list of the directories contained in the `bmsapp` application:
|
|
|
|
|
|
|
|
```
|
|
|
|
. : Main directory with Django models.py, views.py, urls.py files
|
|
|
|
├── calcs : Modules to create calculated sensor readings, and to transform sensor values
|
|
|
|
│ └── metar : Library to parse National Weather Service METAR formatted data
|
|
|
|
├── fixtures : Initial values to store in the main Django database
|
|
|
|
├── logs : Log files that are generated by the app are stored here
|
|
|
|
├── migrations : Django database migration files
|
|
|
|
├── readingdb : All code and data for the Sensor Reading Database
|
|
|
|
│ └── data : Sensor Reading Database is stored here
|
|
|
|
│ └── bak : Backups of the Sensor Reading Database stored here.
|
|
|
|
├── reports : Modules used to produce each BMON chart/report type
|
|
|
|
├── scripts : Modules used with the main Cron job that runs every 1/2 hour
|
|
|
|
│ └── files : Miscellaneous files related to the scripts.
|
|
|
|
├── static : All static content for the app
|
|
|
|
│ └── bmsapp
|
|
|
|
│ ├── css : CSS style sheets
|
|
|
|
│ ├── images : Image files
|
|
|
|
│ └── scripts : JavaScript and CoffeeScript files
|
|
|
|
└── templates
|
|
|
|
└── bmsapp : Django Template files
|
|
|
|
```
|
|
|
|
|
|
|
|
### views.py Module
|
|
|
|
|
| ... | ... | @@ -30,6 +52,10 @@ Some of the important functions in the `views.py` module are: |
|
|
|
|
|
|
|
**`get_report_results()`**: The Reports page in the browser is a [[Single Page Application|https://en.wikipedia.org/wiki/Single-page_application]]. When the User makes a change to the input controls on that page that affects the report or chart, this function is called by the browser to request the new report or chart content. More explanation of the data format returned in provided in the Client Application section of this document.
|
|
|
|
|
|
|
|
**`bldg_list()`**: This function returns a list of buildings to display to the user for selection.
|
|
|
|
**`bldg_list()`**: Returns a list of buildings to display to the user for selection.
|
|
|
|
|
|
|
|
**`chart_sensor_list()`**: |
|
|
\ No newline at end of file |
|
|
|
**`chart_sensor_list()`**: Returns a list of charts/reports and a list of sensors that are appropriate for the current building selected by the user.
|
|
|
|
|
|
|
|
### Sensor Reading Database
|
|
|
|
|
|
|
|
All interactions with the Sensor Reading Database occur through the `BMSdata` class located in the [[bmsdata.py module|https://github.com/alanmitchell/bmon/blob/master/bmsapp/readingdb/bmsdata.py]]. The class contains methods for storage of sensor readings, retrieval of sensor readings, and database backup operations. For an installed BMON system, the first sensor reading database operation will cause the creation of the SQLite database, which will be stored in the `bmon/bmsapp/readingdb/data` directory. When the `BMSdata.backup_db()` method is called, the backup files of the SQLite database are placed in the `bmon/bmsapp/readingdb/data/bak` directory; backup files older than a certain number of days (a method parameter) are deleted when a new backup file is stored. |
|
|
\ No newline at end of file |