Django项目:CMDB(服务器硬件资产自动采集系统)--07--06CMDB测试Linux系统采集硬件数据的命令02

  1 #settings.py
  2 """
  3 Django settings for AutoCmdb project.
  4 
  5 Generated by 'django-admin startproject' using Django 2.0.6.
  6 
  7 For more information on this file, see
  8 https://docs.djangoproject.com/en/2.0/topics/settings/
  9 
 10 For the full list of settings and their values, see
 11 https://docs.djangoproject.com/en/2.0/ref/settings/
 12 """
 13 
 14 import os
 15 
 16 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 17 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 18 
 19 
 20 # Quick-start development settings - unsuitable for production
 21 # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
 22 
 23 # SECURITY WARNING: keep the secret key used in production secret!
 24 SECRET_KEY = '35d18e6vmo0k*xg#h=&kuer*t3a#@hv09@@kvz@=dd@dzw&!7w'
 25 
 26 # SECURITY WARNING: don't run with debug turned on in production!
 27 DEBUG = True
 28 
 29 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 30 # ALLOWED_HOSTS = []
 31 ALLOWED_HOSTS = ['*']
 32 """
 33 ALLOWED_HOSTS是为了限定请求中的host值,以防止黑客构造包来发送请求.只有在列表中的host才能访问.
 34 强烈建议不要使用*通配符去配置,另外当DEBUG设置为False的时候必须配置这个配置.否则会抛出异常.
 35 配置模板如下:
 36 ALLOWED_HOSTS = [
 37     '.example.com',  # Allow domain and subdomains
 38     '.example.com.',  # Also allow FQDN and subdomains
 39 ]
 40 """
 41 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 42 
 43 
 44 # Application definition
 45 
 46 INSTALLED_APPS = [
 47     'django.contrib.admin',
 48     'django.contrib.auth',
 49     'django.contrib.contenttypes',
 50     'django.contrib.sessions',
 51     'django.contrib.messages',
 52     'django.contrib.staticfiles',
 53     'api.apps.ApiConfig',
 54 ]
 55 
 56 MIDDLEWARE = [
 57     'django.middleware.security.SecurityMiddleware',
 58     'django.contrib.sessions.middleware.SessionMiddleware',
 59     'django.middleware.common.CommonMiddleware',
 60     'django.middleware.csrf.CsrfViewMiddleware',
 61     'django.contrib.auth.middleware.AuthenticationMiddleware',
 62     'django.contrib.messages.middleware.MessageMiddleware',
 63     'django.middleware.clickjacking.XFrameOptionsMiddleware',
 64 ]
 65 
 66 ROOT_URLCONF = 'AutoCmdb.urls'
 67 
 68 TEMPLATES = [
 69     {
 70         'BACKEND': 'django.template.backends.django.DjangoTemplates',
 71         'DIRS': [],
 72         'APP_DIRS': True,
 73         'OPTIONS': {
 74             'context_processors': [
 75                 'django.template.context_processors.debug',
 76                 'django.template.context_processors.request',
 77                 'django.contrib.auth.context_processors.auth',
 78                 'django.contrib.messages.context_processors.messages',
 79             ],
 80         },
 81     },
 82 ]
 83 
 84 WSGI_APPLICATION = 'AutoCmdb.wsgi.application'
 85 
 86 
 87 # Database
 88 # https://docs.djangoproject.com/en/2.0/ref/settings/#databases
 89 
 90 DATABASES = {
 91     'default': {
 92         'ENGINE': 'django.db.backends.sqlite3',
 93         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
 94     }
 95 }
 96 
 97 
 98 # Password validation
 99 # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
100 
101 AUTH_PASSWORD_VALIDATORS = [
102     {
103         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
104     },
105     {
106         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
107     },
108     {
109         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
110     },
111     {
112         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
113     },
114 ]
115 
116 
117 # Internationalization
118 # https://docs.djangoproject.com/en/2.0/topics/i18n/
119 
120 LANGUAGE_CODE = 'en-us'
121 
122 TIME_ZONE = 'UTC'
123 
124 USE_I18N = True
125 
126 USE_L10N = True
127 
128 USE_TZ = True
129 
130 
131 # Static files (CSS, JavaScript, Images)
132 # https://docs.djangoproject.com/en/2.0/howto/static-files/
133 
134 STATIC_URL = '/static/'
135 
136 TEMPLATE_DIRS = (os.path.join(BASE_DIR,  'templates'),)
137 
138 # ————————03CMDB信息安全API接口交互认证————————
139 ASSET_AUTH_KEY = '299095cc-1330-11e5-b06a-a45e60bec08b' #认证的密码
140 
141 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
142 # ASSET_AUTH_TIME = 2  #认证的有效时间 #2秒.
143 ASSET_AUTH_TIME = 30  #认证的有效时间 #2秒. #远程时注意系统时间差和网络延迟,根据实际情况配置。
144 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
145 
146 # ————————03CMDB信息安全API接口交互认证————————
#settings.py

猜你喜欢

转载自www.cnblogs.com/ujq3/p/9242092.html