diff options
author | dk-15 | 2017-05-22 16:28:20 +0530 |
---|---|---|
committer | dk-15 | 2017-05-22 16:29:48 +0530 |
commit | 187752f92a1aaed0408a20e8e40b9d1b82b69847 (patch) | |
tree | 1d8e283a2776bb8cebc37cd9297f717f6f9cb066 /sbhs_server | |
parent | d2db202479579f85b0947836d412902bf3e6b0ee (diff) | |
download | SBHS-2018-Rpi-187752f92a1aaed0408a20e8e40b9d1b82b69847.tar.gz SBHS-2018-Rpi-187752f92a1aaed0408a20e8e40b9d1b82b69847.tar.bz2 SBHS-2018-Rpi-187752f92a1aaed0408a20e8e40b9d1b82b69847.zip |
Write views for admin/testing
Diffstat (limited to 'sbhs_server')
-rw-r--r-- | sbhs_server/sbhs.py | 3 | ||||
-rw-r--r-- | sbhs_server/settings.py | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/sbhs_server/sbhs.py b/sbhs_server/sbhs.py index 5c64fd7..c9620e9 100644 --- a/sbhs_server/sbhs.py +++ b/sbhs_server/sbhs.py @@ -174,8 +174,7 @@ class Sbhs: return False def reset_board(self): - self.setFan(100) - self.setHeat(0) + return self.setHeat(0) and self.setFan(100) def _read(self, size): try: diff --git a/sbhs_server/settings.py b/sbhs_server/settings.py index ca3d133..b7ec8b7 100644 --- a/sbhs_server/settings.py +++ b/sbhs_server/settings.py @@ -10,6 +10,9 @@ https://docs.djangoproject.com/en/1.6/ref/settings/ import sys #srikant import socket import sbhs_server.credentials as credentials + + + hostname = socket.gethostname() is_production = hostname == "vlabs-Veriton-Series" @@ -32,6 +35,8 @@ TEMPLATE_DEBUG = not is_production ALLOWED_HOSTS = [ "localhost", "127.0.0.1", + "192.168.43.208", + "192.168.43.144", ] if not DEBUG: @@ -57,6 +62,7 @@ INSTALLED_APPS = ( 'undelete', #'yaksh', 'taggit', + #'corsheaders' 'account', 'myadmin', @@ -68,19 +74,21 @@ INSTALLED_APPS = ( 'webcam', ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + #'corsheaders.middleware.CorsMiddleware', ) ROOT_URLCONF = 'sbhs_server.urls' WSGI_APPLICATION = 'sbhs_server.wsgi.application' +#CORS_ORIGIN_ALLOW_ALL=True # Database # https://docs.djangoproject.com/en/1.6/ref/settings/#databases @@ -238,10 +246,12 @@ SBHS_GLOBAL_LOG_DIR = os.path.join(BASE_DIR, 'log') from sbhs_server import sbhs boards = {} +MID_PORT_MAP={} with open(os.path.join(BASE_DIR, 'map_machine_ids.txt')) as f: for line in f: try: data = line.split("=") + MID_PORT_MAP[int(data[0])]=data[1].strip() brd = sbhs.Sbhs() b = brd.connect(int(data[0])) assert b == True |