urls.py 2.82 KB
Newer Older
1
'''
Alan Mitchell's avatar
Alan Mitchell committed
2 3 4
URLs for the BMS Application
'''

5
from django.conf.urls import url
Alan Mitchell's avatar
Alan Mitchell committed
6
from django.urls import re_path
Alan Mitchell's avatar
Alan Mitchell committed
7 8 9
from bmsapp import views
from bmsapp import views_api_v1
from bmsapp import views_api_v2
Alan Mitchell's avatar
Alan Mitchell committed
10

11
# Could work on simplifying many of these by using the new "path" function
12
urlpatterns = [
Alan Mitchell's avatar
Alan Mitchell committed
13 14
    re_path(r'^readingdb/reading/(\w+)/store/$', views.store_reading),      # URL to store one reading into database
    re_path(r'^readingdb/reading/store/$', views.store_readings),          # URL to store multiple readings into database
15 16
    re_path(r'^readingdb/reading/store-things/$', views.store_readings_things),  # URL to store readings from Things Network
    re_path(r'^readingdb/reading/store-rb/$', views.store_readings_radio_bridge),
Alan Mitchell's avatar
Alan Mitchell committed
17 18 19 20 21 22
    re_path(r'^st8(\w+)/', views.store_reading_old),             # Old URL pattern for storing.  Shouldn't be used for new sensors.
    re_path(r'^readingdb/reading/(\w+)/$', views.get_readings),   # gets all readings for one reading ID.
    re_path(r'^$', views.index, name='index'),
    re_path(r'^reports/$', views.reports, name='reports'),
    re_path(r'^reports/results/$', views.get_report_results),
    re_path(r'^reports/embed/$', views.get_embedded_results), # javascript embedded version of report results
23
    re_path(r'^energy-reports/$', views.energy_reports),
Alan Mitchell's avatar
Alan Mitchell committed
24 25 26 27 28 29 30 31 32 33 34 35 36
    re_path(r'^custom-reports/$', views.custom_report_list),
    re_path(r'^custom-reports/(.+)$', views.custom_report),
    re_path(r'^show-log/$', views.show_log),
    re_path(r'^group-list/(\d+)/$', views.group_list),
    re_path(r'^bldg-list/(\d+)/(\d+)/$', views.bldg_list),
    re_path(r'^chart-sensor-list/(\d+)/(multi)/$', views.chart_sensor_list),
    re_path(r'^chart-sensor-list/(\d+)/(\d+)/$', views.chart_sensor_list),
    re_path(r'^map-json/$', views.map_json, name='map-json'),
    re_path(r'^training/video/(\w+)/(\d+)/(\d+)/$', views.show_video, name='show-video'),
    re_path(r'^make-store-key/$', views.make_store_key),
    re_path(r'^ecobee-auth/$', views.ecobee_auth),
    re_path(r'^unassigned-sensors/$', views.unassigned_sensors),
    re_path(r'^backup-readings/$', views.backup_reading_db),
37

38
    # Views related to the API, version 1
39
    re_path(r'^api/v1/version/$', views_api_v1.api_version),
Alan Mitchell's avatar
Alan Mitchell committed
40 41
    re_path(r'^api/v1/readings/(.+)/$', views_api_v1.sensor_readings),
    re_path(r'^api/v1/sensors/$', views_api_v1.sensor_list),
42

Alan Mitchell's avatar
Alan Mitchell committed
43 44
    # Views related to the API, version 2
    re_path(r'^api/v2/version/$', views_api_v2.api_version),
45
    re_path(r'^api/v2/readings/$', views_api_v2.sensor_readings),
Alan Mitchell's avatar
Alan Mitchell committed
46 47
    re_path(r'^api/v2/sensors/$', views_api_v2.sensors),
    re_path(r'^api/v2/buildings/$', views_api_v2.buildings),
48
    re_path(r'^api/v2/organizations/$', views_api_v2.organizations),
Alan Mitchell's avatar
Alan Mitchell committed
49

50
    # catches URLs that don't match the above patterns.  Assumes they give a template name to render.
Alan Mitchell's avatar
Alan Mitchell committed
51
    re_path(r'^([^.]+)/$', views.wildcard, name='wildcard'),
52
]