blob: 4c93ca4eebbc9f3cc96a7b4f2d8282992c2dc0b5 (
plain) (
blame)
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
|
"""
This module contains utility functions for use in standalone scripts.
"""
from django.conf import settings
from rpki.config import parser
__version__ = '$Id$'
def setup():
"""
Configure Django enough to use the ORM.
"""
cfg = parser(section='web_portal')
# INSTALLED_APPS doesn't seem necessary so long as you are only accessing
# existing tables.
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': cfg.get('sql-database'),
'USER': cfg.get('sql-username'),
'PASSWORD': cfg.get('sql-password'),
}
},
)
|