Browse Source

py-i2phosts-builder: add config file support

pull/1/head
Hidden Z 14 years ago
parent
commit
e64139d729
  1. 7
      py-i2phosts-builder

7
py-i2phosts-builder

@ -3,6 +3,7 @@
import os import os
import sys import sys
import argparse import argparse
import configobj
# parse command line options # parse command line options
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
@ -12,6 +13,12 @@ parser.add_argument('-c', '--config', default='/etc/py-i2phosts/builder.conf', d
help='config file to use') help='config file to use')
args = parser.parse_args() args = parser.parse_args()
# read config
config = configobj.ConfigObj(args.config_file, file_error=True)
if 'include' in config:
config_included = configobj.ConfigObj(config['include'])
config.merge(config_included)
# django setup # django setup
DJANGO_SETTINGS_MODULE = 'settings' DJANGO_SETTINGS_MODULE = 'settings'
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web' DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web'

Loading…
Cancel
Save