瀏覽代碼

alexa智能插座分区

peng 1 年之前
父節點
當前提交
e18e3a32b0
共有 2 個文件被更改,包括 25 次插入30 次删除
  1. 24 29
      azoauth/settings.py
  2. 1 1
      model/models.py

+ 24 - 29
azoauth/settings.py

@@ -15,7 +15,6 @@ import os
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
 
-
 # Quick-start development settings - unsuitable for production
 # Quick-start development settings - unsuitable for production
 # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
 # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
 
 
@@ -27,7 +26,6 @@ DEBUG = True
 
 
 ALLOWED_HOSTS = ['*']
 ALLOWED_HOSTS = ['*']
 
 
-
 # Application definition
 # Application definition
 
 
 INSTALLED_APPS = [
 INSTALLED_APPS = [
@@ -74,31 +72,31 @@ TEMPLATES = [
 
 
 WSGI_APPLICATION = 'azoauth.wsgi.application'
 WSGI_APPLICATION = 'azoauth.wsgi.application'
 
 
-
 # Database
 # Database
 # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
 # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
 
 
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.sqlite3',
-        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
-    }
-}
-# DATABASE_DATA = 'alexa_oauth'
-# SERVER_HOST = 'azrdsinstance.clraczw4p0yj.us-west-1.rds.amazonaws.com'
-# DATABASES_USER = 'azrds'
-# DATABASES_PASS = 'azrds.x.x'
-#
-# DATABASES = {'default': {
-#     'ENGINE': 'django.db.backends.mysql',
-#     'NAME': DATABASE_DATA,
-#     'USER': DATABASES_USER,
-#     'PASSWORD': DATABASES_PASS,
-#     'HOST': SERVER_HOST,
-#     'PORT': '3306',
-#     'OPTIONS': {'charset': 'utf8mb4', 'use_unicode': True, 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
-#     'AUTOCOMMIT': True
-# }}
+# DATABASES = {
+#     'default': {
+#         'ENGINE': 'django.db.backends.sqlite3',
+#         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+#     }
+# }
+
+DATABASE_DATA = 'Alexa'
+SERVER_HOST = 'database-2.clraczw4p0yj.us-west-1.rds.amazonaws.com'
+DATABASES_USER = 'azrds'
+DATABASES_PASS = 'azrds.x.x'
+
+DATABASES = {'default': {
+    'ENGINE': 'django.db.backends.mysql',
+    'NAME': DATABASE_DATA,
+    'USER': DATABASES_USER,
+    'PASSWORD': DATABASES_PASS,
+    'HOST': SERVER_HOST,
+    'PORT': '3306',
+    'OPTIONS': {'charset': 'utf8mb4', 'use_unicode': True, 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
+    'AUTOCOMMIT': True
+}}
 
 
 # Password validation
 # Password validation
 # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
 # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
@@ -118,7 +116,6 @@ AUTH_PASSWORD_VALIDATORS = [
     },
     },
 ]
 ]
 
 
-
 # Internationalization
 # Internationalization
 # https://docs.djangoproject.com/en/2.1/topics/i18n/
 # https://docs.djangoproject.com/en/2.1/topics/i18n/
 
 
@@ -132,7 +129,6 @@ USE_L10N = True
 
 
 USE_TZ = True
 USE_TZ = True
 
 
-
 # Static files (CSS, JavaScript, Images)
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/2.1/howto/static-files/
 # https://docs.djangoproject.com/en/2.1/howto/static-files/
 
 
@@ -192,7 +188,7 @@ LOGGING = {
         'info': {  # 向文件中输出日志
         'info': {  # 向文件中输出日志
             'level': 'INFO',
             'level': 'INFO',
             'class': 'logging.handlers.RotatingFileHandler',
             'class': 'logging.handlers.RotatingFileHandler',
-            'filename': os.path.join(BASE_DIR+'/logs/', "info.log"),  # 日志文件的位置
+            'filename': os.path.join(BASE_DIR + '/logs/', "info.log"),  # 日志文件的位置
             'maxBytes': 300 * 1024 * 1024,  # 300M大小
             'maxBytes': 300 * 1024 * 1024,  # 300M大小
             'backupCount': 10,
             'backupCount': 10,
             'formatter': 'verbose',
             'formatter': 'verbose',
@@ -200,11 +196,10 @@ LOGGING = {
         },
         },
     },
     },
     'loggers': {  # 日志器
     'loggers': {  # 日志器
-        "django": {        # 默认的logger应用如下配置
+        "django": {  # 默认的logger应用如下配置
             "handlers": ["info", "console"],
             "handlers": ["info", "console"],
             "propagate": True,
             "propagate": True,
             "level": "INFO"
             "level": "INFO"
         },
         },
     }
     }
 }
 }
-

+ 1 - 1
model/models.py

@@ -63,7 +63,7 @@ class UidRtspModel(models.Model):
 class SwitchModel(models.Model):
 class SwitchModel(models.Model):
     id = models.AutoField(primary_key=True)
     id = models.AutoField(primary_key=True)
     nick = models.CharField(max_length=32, verbose_name=u'设备昵称', default='')
     nick = models.CharField(max_length=32, verbose_name=u'设备昵称', default='')
-    serial_number = models.CharField(max_length=20, verbose_name=u'设备序列号', default='', unique=True)
+    serial_number = models.CharField(max_length=20, verbose_name=u'设备序列号', default='')
     userID = models.CharField(blank=True, max_length=32, verbose_name=u'用户ID')
     userID = models.CharField(blank=True, max_length=32, verbose_name=u'用户ID')
     region = models.CharField(max_length=8, verbose_name='区域', default='EN')
     region = models.CharField(max_length=8, verbose_name='区域', default='EN')
     addTime = models.IntegerField(verbose_name='添加时间', default=0)
     addTime = models.IntegerField(verbose_name='添加时间', default=0)