- Понятия не имею, если речь идет о
materialized views
. Друг из Гиттера сказал мне:
материализованные представления обычно добавляются в проект позже, когда у вас есть другой потребитель данных. Вы редко захотите отключить модель django от материализованного представления, если не хотите работать, чтобы повысить производительность. https://www.fusionbox.com/blog/detail/using-materialized-views-to-implement-efficient-reports-in-django/643/ sql отчетность и т. Д.
- Я добавил force_insert = True в Power.save () и затем тупики исчезли. Но я не знаю, как это работает и вызовет ли это другой побочный эффект. Есть предложения?
ВОПРОС
Вот три модели из существующего проекта вне моего контроля.
class Asset(models.Model):
...many fields...
class Device(Asset):
...many fields...
class Power(Device):
...many fields...
Все они таблицы материалов в базе данных.
И простой API с одной строкой:
@api_view(['POST'])
def xxx(request):
Power.objects.create(**request.data)
Затем я провел стресс-тестирование с JMeter, 100 запросов POST за 2 секунды. Более 50 не удалось из-за тупика MySQL.
Как исправить или избежать взаимоблокировок без изменения моделей?
FYI
логи из регистратора django.db.backends
(один обычный запрос)
[2018-09-18 09:57:49,496] DEBUG: (0.000) SELECT @@SQL_AUTO_IS_NULL; args=None [utils.py:90]
[2018-09-18 09:57:49,497] DEBUG: (0.000) SELECT VERSION(); args=None [utils.py:90]
[2018-09-18 09:57:49,498] DEBUG: (0.001) INSERT INTO `ais_asset` (`name`, `uuid`, `assets_type_level1`, `assets_type_level2_id`, `quantity`, `is_real`, `source`, `asset_number`, `status`, `owner`, `creator`, `create_time`, `last_modify_time`, `tags`, `asset_usage_info`, `position`, `attachment`, `note`, `used_for`) VALUES ('Neque', '041084ba80e546ddbe6ee8c4875a7370', 'Other', NULL, 1, 1, 'other', 'Debit', 'normal', 'Obcaecati nemo de', 'Facere quaerat ducimus repella', '2018-09-18 01:57:49', '2018-09-18 01:57:49', 'Even', 'Esse t', 'Aliquam', 'Sit si', 'Lorem ipsum', 'Nam mollitia'); args=['Neque', '041084ba80e546ddbe6ee8c4875a7370', 'Other', None, 1, True, 'other', 'Debit', 'normal', 'Obcaecati nemo de', 'Facere quaerat ducimus repella', '2018-09-18 01:57:49', '2018-09-18 01:57:49', 'Even', 'Esse t', 'Aliquam', 'Sit si', 'Lorem ipsum', 'Nam mollitia'] [utils.py:90]
[2018-09-18 09:57:49,499] DEBUG: (0.001) UPDATE `ais_device` SET `device_type` = 'PC', `ip` = 'Voluptatem vel repellat a assum', `wlan_subnet_mask` = '255.255.255.0', `wlan_gateway` = '192.168.0.1', `lan_ip` = 'Solu', `lan_subnet_mask` = '255.255.255.0', `lan_gateway` = '192.168.0.1', `mac` = 'Voluptates eius id. Eu', `port` = 8000, `username` = 'Cumque quis p', `password` = 'Beatae incidunt sequi asperiores repe', `serial_no` = 'Esse ', `restore_info` = 'Tenetur t', `manage_ip` = 'Assumenda dicta optio eni' WHERE `ais_device`.`asset_ptr_id` = 57909; args=('PC', 'Voluptatem vel repellat a assum', '255.255.255.0', '192.168.0.1', 'Solu', '255.255.255.0', '192.168.0.1', 'Voluptates eius id. Eu', 8000, 'Cumque quis p', 'Beatae incidunt sequi asperiores repe', 'Esse ', 'Tenetur t', 'Assumenda dicta optio eni', 57909) [utils.py:90]
[2018-09-18 09:57:49,499] DEBUG: (0.000) INSERT INTO `ais_device` (`asset_ptr_id`, `device_type`, `ip`, `wlan_subnet_mask`, `wlan_gateway`, `lan_ip`, `lan_subnet_mask`, `lan_gateway`, `mac`, `port`, `username`, `password`, `serial_no`, `restore_info`, `manage_ip`) VALUES (57909, 'PC', 'Voluptatem vel repellat a assum', '255.255.255.0', '192.168.0.1', 'Solu', '255.255.255.0', '192.168.0.1', 'Voluptates eius id. Eu', 8000, 'Cumque quis p', 'Beatae incidunt sequi asperiores repe', 'Esse ', 'Tenetur t', 'Assumenda dicta optio eni'); args=(57909, 'PC', 'Voluptatem vel repellat a assum', '255.255.255.0', '192.168.0.1', 'Solu', '255.255.255.0', '192.168.0.1', 'Voluptates eius id. Eu', 8000, 'Cumque quis p', 'Beatae incidunt sequi asperiores repe', 'Esse ', 'Tenetur t', 'Assumenda dicta optio eni') [utils.py:90]
[2018-09-18 09:57:49,500] DEBUG: (0.000) INSERT INTO `ais_power` (`device_ptr_id`, `output_num`, `power_model`, `protocol`, `manufacturer`) VALUES (57909, 0, 'Alias sunt deleni', NULL, 'Vitae alias dolorem'); args=(57909, 0, 'Alias sunt deleni', None, 'Vitae alias dolorem') [utils.py:90]
[2018-09-18 09:57:49,502] INFO: "POST /test_create_power/?operator=xxx HTTP/1.1" 200 63 [basehttp.py:124]
отслеживающий:
InternalError at /test_create_power/
(1213, 'Deadlock found when trying to get lock; try restarting transaction')
Request Method: POST
Request URL: http://localhost:8080/test_create_power/?operator=xxx
Django Version: 1.11.9
Python Executable: /home/k/.venvs/ais_py36/bin/python
Python Version: 3.6.5
Python Path: ['/home/k/Host/D/Workspace/ais', '/home/k/.venvs/ais_py36/lib/python36.zip', '/home/k/.venvs/ais_py36/lib/python3.6', '/home/k/.venvs/ais_py36/lib/python3.6/lib-dynload', '/home/k/.pyenv/versions/3.6.5/lib/python3.6', '/home/k/.venvs/ais_py36/lib/python3.6/site-packages']
Server time: ææäº, 18 ä¹æ 2018 09:54:06 +0800
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'django_filters',
'ais']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'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']
Traceback:
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/backends/mysql/base.py" in execute
101. return self.cursor.execute(query, args)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/cursors.py" in execute
166. result = self._query(query)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/cursors.py" in _query
322. conn.query(q)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in query
856. self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in _read_query_result
1057. result.read()
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in read
1340. first_packet = self.connection._read_packet()
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in _read_packet
1014. packet.check_error()
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in check_error
393. err.raise_mysql_exception(self._data)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/err.py" in raise_mysql_exception
107. raise errorclass(errno, errval)
The above exception ((1213, 'Deadlock found when trying to get lock; try restarting transaction')) was the direct cause of the following exception:
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/k/.pyenv/versions/3.6.5/lib/python3.6/contextlib.py" in inner
52. return func(*args, **kwds)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
483. response = self.handle_exception(exc)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/rest_framework/views.py" in handle_exception
443. self.raise_uncaught_exception(exc)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
480. response = handler(request, *args, **kwargs)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/rest_framework/decorators.py" in handler
53. return func(*args, **kwargs)
File "/home/k/Host/D/Workspace/ais/ais/views/asset.py" in test_create_power
54. obj = Power.objects.create(**request.data)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
85. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/query.py" in create
394. obj.save(force_insert=True, using=self.db)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/base.py" in save
808. force_update=force_update, update_fields=update_fields)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/base.py" in save_base
837. self._save_parents(cls, using, update_fields)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/base.py" in _save_parents
864. self._save_table(cls=parent, using=using, update_fields=update_fields)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/base.py" in _save_table
924. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/base.py" in _do_insert
963. using=using, raw=raw)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
85. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/query.py" in _insert
1076. return query.get_compiler(using=using).execute_sql(return_id)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
1112. cursor.execute(sql, params)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/utils.py" in __exit__
94. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/django/db/backends/mysql/base.py" in execute
101. return self.cursor.execute(query, args)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/cursors.py" in execute
166. result = self._query(query)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/cursors.py" in _query
322. conn.query(q)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in query
856. self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in _read_query_result
1057. result.read()
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in read
1340. first_packet = self.connection._read_packet()
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in _read_packet
1014. packet.check_error()
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/connections.py" in check_error
393. err.raise_mysql_exception(self._data)
File "/home/k/.venvs/ais_py36/lib/python3.6/site-packages/pymysql/err.py" in raise_mysql_exception
107. raise errorclass(errno, errval)
Exception Type: InternalError at /test_create_power/
Exception Value: (1213, 'Deadlock found when trying to get lock; try restarting transaction')
Request information:
USER: AnonymousUser
GET:
operator = 'xxx'
POST: No POST data
FILES: No FILES data
COOKIES: No cookie data
META:
BROWSER = '/usr/bin/chromium'
CATALINA_HOME = '/usr/share/tomcat8'
COLORTERM = 'truecolor'
CONTENT_LENGTH = '4022'
CONTENT_TYPE = 'application/json'
DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
DIRHISTORY_SIZE = '30'
DISPLAY = ':0'
DJANGO_SETTINGS_MODULE = 'ais.settings.default'
EDITOR = 'vim'
FZF_DEFAULT_COMMAND = 'fd --type f --hidden --follow --exclude .git'
FZF_DEFAULT_OPTS = "--preview '[ -f {} ] && file {} && head -30 {} '\n --height 50% --reverse --border\n --preview-window=down:30%"
GATEWAY_INTERFACE = 'CGI/1.1'
GREP_COLOR = '1;32'
GTK_IM_MODULE = 'fcitx'
GTK_MODULES = 'canberra-gtk-module'
HOME = '/home/k'
HTTP_CONNECTION = 'keep-alive'
HTTP_HOST = 'localhost:8080'
HTTP_USER_AGENT = 'Apache-HttpClient/4.5.5 (Java/1.8.0_181)'
INVOCATION_ID = '6ba467f2df4d4f219c723257c89bd973'
JOURNAL_STREAM = '9:15374'
LANG = 'en_US.UTF-8'
LC_ADDRESS = 'zh_CN.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
LC_IDENTIFICATION = 'zh_CN.UTF-8'
LC_MEASUREMENT = 'zh_CN.UTF-8'
LC_MESSAGES = ''
LC_MONETARY = 'zh_CN.UTF-8'
LC_NAME = 'zh_CN.UTF-8'
LC_NUMERIC = 'zh_CN.UTF-8'
LC_PAPER = 'zh_CN.UTF-8'
LC_TELEPHONE = 'zh_CN.UTF-8'
LC_TIME = 'zh_CN.UTF-8'
LESS = '-R'
LOGNAME = 'k'
LSCOLORS = 'Gxfxcxdxbxegedabagacad'
LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
MAIL = '/var/spool/mail/k'
OLDPWD = '/home/k/Workspace/ais'
PAGER = 'less'
PATH = '/home/k/.venvs/ais_py36/bin:/home/k/.pyenv/plugins/pyenv-virtualenv/shims:/home/k/.pyenv/shims:/home/k/.pyenv/shims:/home/k/.pyenv/plugins/pyenv-virtualenv/shims:/home/k/.pyenv/shims:/home/k/.pyenv/shims:/home/k/.pyenv/plugins/pyenv-virtualenv/shims:/home/k/.pyenv/shims:/home/k/.pyenv/shims:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/k/.pyenv/bin:/home/k/.pyenv/bin:/home/k/.gem/ruby/2.5.0/bin:/home/k/.gem/ruby/2.5.0/bin:/home/k/.pyenv/bin:/home/k/.gem/ruby/2.5.0/bin:/home/k/.gem/ruby/2.5.0/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/k/.pyenv/bin:/home/k/.gem/ruby/2.5.0/bin:/home/k/.gem/ruby/2.5.0/bin'
PATH_INFO = '/test_create_power/'
PWD = '/home/k/Workspace/ais'
PYENV_SHELL = 'zsh'
PYENV_VIRTUALENV_INIT = '1'
PY_VIRTUAL_ENV_DIR = '/home/k/.venvs'
QT_IM_MODULE = 'fcitx'
QUERY_STRING = 'operator=xxx'
REMOTE_ADDR = '127.0.0.1'
REMOTE_HOST = ''
REQUEST_METHOD = 'POST'
RUN_MAIN = 'true'
SCRIPT_NAME = ''
SERVER_NAME = 'localhost'
SERVER_PORT = '8080'
SERVER_PROTOCOL = 'HTTP/1.1'
SERVER_SOFTWARE = 'WSGIServer/0.2'
SHELL = '/usr/bin/zsh'
SHLVL = '6'
SSH_AGENT_PID = '1190'
SSH_AUTH_SOCK = '/tmp/ssh-yTACcimZXel2/agent.1188'
TERM = 'tmux-256color'
TERMINAL = '/usr/bin/xfce4-terminal'
TMUX = '/tmp/tmux-1000/default,3423,0'
TMUX_PANE = '%8'
TZ = 'Asia/Shanghai'
UPDATE_ZSH_DAYS = '3'
USER = 'k'
VIRTUAL_ENV = '/home/k/.venvs/ais_py36'
VIRTUAL_ENV_DISABLE_PROMPT = '1'
VISUAL = 'vim'
VTE_VERSION = '5202'
WINDOWID = '33554497'
WINDOWPATH = '1'
WORKON_HOME = '/home/k/.venvs'
XAUTHORITY = '/home/k/.Xauthority'
XDG_RUNTIME_DIR = '/run/user/1000'
XDG_SEAT = 'seat0'
XDG_SESSION_ID = 'c1'
XDG_VTNR = '1'
XMODIFIERS = '@im=fcitx'
ZSH = '/home/k/.oh-my-zsh'
ZSH_TMUX_TERM = 'screen-256color'
_ = '/home/k/.venvs/ais_py36/bin/python'
_ZSH_TMUX_FIXED_CONFIG = '/home/k/.oh-my-zsh/plugins/tmux/tmux.extra.conf'
wsgi.errors = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>
wsgi.file_wrapper = ''
wsgi.input = <_io.BufferedReader name=4>
wsgi.multiprocess = False
wsgi.multithread = True
wsgi.run_once = False
wsgi.url_scheme = 'http'
wsgi.version = '(1, 0)'
Settings:
Using settings module ais.settings.default
ABSOLUTE_URL_OVERRIDES = {}
ADMINS = []
ALLOWED_HOSTS = ['*']
APPEND_SLASH = True
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS = '********************'
AUTH_USER_MODEL = 'auth.User'
BASE_DIR = '/home/k/Host/D/Workspace/ais/ais'
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_KEY_PREFIX = '********************'
CACHE_MIDDLEWARE_SECONDS = 600
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
CSRF_USE_SESSIONS = False
DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'NAME': 'ais', 'USER': 'root', 'PASSWORD': '********************', 'HOST': '10.66.204.42', 'PORT': '3306', 'ATOMIC_REQUESTS': True, 'TEST': {'NAME': 'test_ais', 'CREATE_DB': False, 'CHARSET': 'utf8', 'COLLATION': 'utf8_general_ci', 'MIRROR': None}, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'OPTIONS': {}, 'TIME_ZONE': None}}
DATABASE_ROUTERS = []
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = 'N j, Y, P'
DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y']
DATE_FORMAT = '%Y-%m-%d'
DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']
DB_HOST = '10.66.204.42'
DB_PASSWORD = '********************'
DEBUG = True
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = '.'
DEFAULT_CHARSET = 'utf-8'
DEFAULT_CONTENT_TYPE = 'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
DEFAULT_INDEX_TABLESPACE = ''
DEFAULT_TABLESPACE = ''
DISALLOWED_USER_AGENTS = []
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_HOST_PASSWORD = '********************'
EMAIL_HOST_USER = ''
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = '********************'
EMAIL_SUBJECT_PREFIX = '[Django] '
EMAIL_TIMEOUT = None
EMAIL_USE_LOCALTIME = False
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
FILE_CHARSET = 'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = []
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS = []
INSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_filters', 'ais']
INTERNAL_IPS = []
LOGGING = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'verbose': {'format': '[%(asctime)s] %(levelname)s: %(message)s [%(filename)s:%(lineno)d]'}}, 'filters': {'require_debug_true': {'()': 'django.utils.log.RequireDebugTrue'}}, 'handlers': {'console': {'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'verbose', 'filters': ['require_debug_true']}, 'error': {'level': 'ERROR', 'class': 'logging.handlers.RotatingFileHandler', 'filename': '/var/log/AIS/error.log', 'maxBytes': 104857600, 'backupCount': 10, 'formatter': 'verbose'}, 'default': {'level': 'INFO', 'class': 'logging.handlers.RotatingFileHandler', 'filename': '/var/log/AIS/default.log', 'maxBytes': 104857600, 'backupCount': 10, 'formatter': 'verbose'}, 'main_admins': {'level': 'WARNING', 'class': 'django.utils.log.AdminEmailHandler'}}, 'loggers': {'ais': {'handlers': ['console', 'default'], 'level': 'DEBUG', 'propagate': True}, 'ais.error': {'handlers': ['console', 'error'], 'level': 'ERROR', 'propagate': False}, 'django.server': {'handlers': ['console', 'default', 'error'], 'level': 'DEBUG'}, 'django.request': {'handlers': ['console', 'default', 'error'], 'level': 'DEBUG'}, 'django.security.*': {'handlers': ['console', 'default', 'error'], 'level': 'DEBUG'}, 'django.db.backends': {'handlers': ['console', 'default', 'error'], 'level': 'DEBUG'}}}
LOGGING_CONFIG = 'logging.config.dictConfig'
LOGIN_REDIRECT_URL = '/accounts/profile/'
LOGIN_URL = '/accounts/login/'
LOGOUT_REDIRECT_URL = None
LOG_PERSISTENCE_DIR = '/var/log/AIS/'
MANAGERS = []
MEDIA_ROOT = ''
MEDIA_URL = ''
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE = ['django.middleware.security.SecurityMiddleware', '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']
MIDDLEWARE_CLASSES = ['django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware']
MIGRATION_MODULES = {}
MONTH_DAY_FORMAT = 'F j'
NUMBER_GROUPING = 0
PASSWORD_HASHERS = '********************'
PASSWORD_RESET_TIMEOUT_DAYS = '********************'
PREPEND_WWW = False
RESPONSE_CODE_FIELD = 'code'
RESPONSE_DATA_FIELD = 'data'
RESPONSE_FAIL_LIST_FIELD = 'fail_list'
RESPONSE_MSG_FIELD = 'message'
RESPONSE_SUCCESS_LIST_FIELD = 'success_list'
REST_FRAMEWORK = {'DEFAULT_PERMISSION_CLASSES': ('ais.utils.permissions.OperatorBasedPermission',), 'EXCEPTION_HANDLER': 'ais.utils.errors.handlers.ais_exception_handler', 'DEFAULT_RENDERER_CLASSES': ('ais.utils.renderers.AisJSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer'), 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',), 'ORDERING_PARAM': 'sort_key', 'PAGE_SIZE': 10, 'DEFAULT_PAGINATION_CLASS': 'ais.utils.pagination.GeneralPagination', 'TEST_REQUEST_RENDERER_CLASSES': ('ais.utils.renderers.AisJSONRenderer',), 'TEST_REQUEST_DEFAULT_FORMAT': 'json'}
ROOT_URLCONF = 'ais.urls'
SECRET_KEY = '********************'
SECURE_BROWSER_XSS_FILTER = False
SECURE_CONTENT_TYPE_NOSNIFF = False
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_HSTS_PRELOAD = False
SECURE_HSTS_SECONDS = 0
SECURE_PROXY_SSL_HEADER = None
SECURE_REDIRECT_EXEMPT = []
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = False
SERVER_EMAIL = 'root@localhost'
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_AGE = 1209600
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = 'sessionid'
SESSION_COOKIE_PATH = '/'
SESSION_COOKIE_SECURE = False
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_FILE_PATH = None
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'ais.settings.default'
SHORT_DATETIME_FORMAT = 'm/d/Y P'
SHORT_DATE_FORMAT = 'm/d/Y'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = []
STATICFILES_DIRS = []
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = None
STATIC_URL = '/static/'
SUPER_USER_NAME = 'xxx'
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR = ','
TIME_FORMAT = 'P'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE = 'Asia/Shanghai'
USE_ETAGS = False
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = False
USE_TZ = True
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WSGI_APPLICATION = 'ais.wsgi.application'
X_FRAME_OPTIONS = 'SAMEORIGIN'