尝试在Django 1.6中设置unsupported operand type(s) for +: 'float' and 'str'
时,我得到CONN_MAX_AGE
。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myDB',
'USER': 'myuser',
'PASSWORD': 'mypass',
'HOST': '',
'CONN_MAX_AGE': '60', # seconds for persistent connection, since Django 1.6
'PORT': '5432',
}
}
答案 0 :(得分:12)
与PORT
不同,请将CONN_MAX_AGE
设置为整数(而不是字符串):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myDB',
'USER': 'myuser',
'PASSWORD': 'mypass',
'HOST': '',
'CONN_MAX_AGE': 60, # seconds for persistent connection, since Django 1.6
'PORT': '5432',
}
}