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 @@ @@ -3,6 +3,7 @@
import os
import sys
import argparse
import configobj
# parse command line options
parser = argparse.ArgumentParser(
@ -12,6 +13,12 @@ parser.add_argument('-c', '--config', default='/etc/py-i2phosts/builder.conf', d @@ -12,6 +13,12 @@ parser.add_argument('-c', '--config', default='/etc/py-i2phosts/builder.conf', d
help='config file to use')
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_SETTINGS_MODULE = 'settings'
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web'

Loading…
Cancel
Save