mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 20:44:55 +00:00
py-i2phosts-checker: take DJANGO_PROJECT_PATH from config
This commit is contained in:
parent
cf5e82c65f
commit
a461c3cbe9
@ -13,13 +13,6 @@ import configobj
|
|||||||
from i2p import samclasses
|
from i2p import samclasses
|
||||||
from i2p import socket
|
from i2p import socket
|
||||||
|
|
||||||
# django setup
|
|
||||||
DJANGO_SETTINGS_MODULE = 'settings'
|
|
||||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web'
|
|
||||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
|
||||||
from web.postkey.models import i2phost
|
|
||||||
|
|
||||||
# parse command line options
|
# parse command line options
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Hosts checker for py-i2phosts.',
|
description='Hosts checker for py-i2phosts.',
|
||||||
@ -35,6 +28,16 @@ config = configobj.ConfigObj(args.config_file, file_error=True)
|
|||||||
config_included = configobj.ConfigObj(config['include'])
|
config_included = configobj.ConfigObj(config['include'])
|
||||||
config.merge(config_included)
|
config.merge(config_included)
|
||||||
|
|
||||||
|
# django setup
|
||||||
|
DJANGO_SETTINGS_MODULE = 'settings'
|
||||||
|
if config['DJANGO_PROJECT_PATH']:
|
||||||
|
DJANGO_PROJECT_PATH = config['DJANGO_PROJECT_PATH']
|
||||||
|
else:
|
||||||
|
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web'
|
||||||
|
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||||
|
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||||
|
from web.postkey.models import i2phost
|
||||||
|
|
||||||
# configure logger
|
# configure logger
|
||||||
log = logging.getLogger(sys.argv[0])
|
log = logging.getLogger(sys.argv[0])
|
||||||
handler = logging.StreamHandler()
|
handler = logging.StreamHandler()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user