forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb-include-fix.py
More file actions
33 lines (33 loc) · 983 Bytes
/
Copy pathdb-include-fix.py
File metadata and controls
33 lines (33 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pathlib import Path
content = Path('/workspace/ietf/settings_local.py').read_text()
newcontent = content.replace(
"""DATABASES = {
'default': {
'HOST': 'db',
'PORT': 3306,
'NAME': 'ietf_utf8',
'ENGINE': 'django.db.backends.mysql',
'USER': 'django',
'PASSWORD': 'RkTkDPFnKpko',
'OPTIONS': {
'sql_mode': 'STRICT_TRANS_TABLES',
'init_command': 'SET storage_engine=InnoDB; SET names "utf8"',
},
},
}""",
"from ietf.settings_mysqldb import DATABASES",
).replace(
"""DATABASES = {
'default': {
'HOST': 'pgdb',
'PORT': 5432,
'NAME': 'ietf',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'django',
'PASSWORD': 'RkTkDPFnKpko',
},
}""",
"from ietf.settings_postgresqldb import DATABASES",
)
with Path('/workspace/ietf/settings_local.py').open('w') as replacementfile:
replacementfile.write(newcontent)