本文整理汇总了Python中settings.py方法的典型用法代码示例。如果您正苦于以下问题:Python settings.py方法的具体用法?Python settings.py怎么用?Python settings.py使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings
的用法示例。
在下文中一共展示了settings.py方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_app
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def get_app(config=None):
"""App factory.
:param config: configuration that can override config from `settings.py`
:return: a new SuperdeskEve app instance
"""
if config is None:
config = {}
config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))
for key in dir(settings):
if key.isupper():
config.setdefault(key, getattr(settings, key))
app = superdesk_app(config)
return app
示例2: load_tools
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def load_tools(self, command_line_object):
# Load all tools within the Tools folder
# (Evasion, Ordnance, Pillage, etc.)
for name in glob.glob('tools/*/tool.py'):
if name.endswith(".py") and ("__init__" not in name):
module = helpers.load_module(name)
self.imported_tools[name] = module.Tools(
command_line_object)
return
示例3: options_veil
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def options_veil(self):
print( " [i] Veil configuration file: /etc/veil/settings.py" )
for i in dir(settings):
if i.startswith('_'): continue
print( " [i] {0}: {1}".format( i , eval( 'settings.' + str(i) )))
input( '\n\nOptions shown. Press enter to continue' )
return
# Self update framework
示例4: config_veil
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def config_veil(self):
if settings.OPERATING_SYSTEM == "Kali":
if os.path.exists("/usr/share/veil/config/update-config.py"):
os.system('cd /usr/share/veil/config/; ./update-config.py')
else:
print("\n [!] ERROR: Kali is missing %s\n" % ("/usr/share/veil/config/update-config.py"))
os.system('cd ./config/; ./update-config.py')
else:
os.system('cd ./config/; ./update-config.py')
input('\n\nVeil has reconfigured, press enter to continue')
return
示例5: load_payloads
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def load_payloads(self, cli_args):
for x in range(1, 5):
for name in glob.glob(join("tools/evasion/payloads/" + "*/" * x,'[!_]*.py')):
if name.endswith(".py") and ("__init__" not in name):
module = helpers.load_module(name)
self.active_payloads[name.replace('tools/evasion/payloads/', '')] = module.PayloadModule(cli_args)
return
示例6: validate_ip
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def validate_ip(val_ip):
# This came from (Mult-line link for pep8 compliance)
# http://python-iptools.googlecode.com/svn-history/r4
# /trunk/iptools/__init__.py
ip_re = re.compile(r'^(\d{1,3}\.){0,3}\d{1,3}$')
if ip_re.match(val_ip):
quads = (int(q) for q in val_ip.split('.'))
for q in quads:
if q > 255:
return False
return True
return False
示例7: index
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def index():
# If they have pressed the refresh link remove the error and success messages
if(request.args.get('action') == "refresh"):
session.pop('ErrorMessage', None)
session.pop('SuccessMessage', None)
session.pop('fuelType', None)
session.pop('LockinPrice', None)
try:
# Regenerate our locked in prices
functions.lockedPrices()
except:
# If there was an error, lets just move on.
pass
# If the environmental variable DEVICE_ID is empty or is not set at all
if(os.getenv('DEVICE_ID', settings.DEVICE_ID) in [None,"changethis",""]):
# Set the device id to a randomly generated one
DEVICE_ID = ''.join(random.choice('0123456789abcdef') for i in range(16))
else:
# Otherwise we set the it to the one set in settings.py
DEVICE_ID = os.getenv('DEVICE_ID', settings.DEVICE_ID)
# Set the session max price for the auto locker
session['max_price'] = config['General']['max_price']
# Get the cheapest fuel price to show on the automatic lock in page
fuelPrice = functions.cheapestFuelAll()
return render_template('price.html',device_id=DEVICE_ID)
示例8: generate_awl
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def generate_awl(self):
ip = subprocess.getoutput("ip a").split("\n")[8][9:].split('/')[0]
for name in sorted(self.active_payloads.keys()):
os.system("python3 /opt/GreatSCT/GreatSCT.py --ip {0} --port 443 -t Bypass -p {1}".format(ip, name))
示例9: load_payloads
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def load_payloads(self, cli_args):
for x in range(1, 5):
for name in glob.glob(join("Tools/Bypass/payloads/" + "*/" * x,'[!_]*.py')):
if name.endswith(".py") and ("__init__" not in name):
loaded_payloads = imp.load_source(
name.replace("/", ".").rstrip('.py'), name)
self.active_payloads[name.replace('Tools/Bypass/payloads/', '')] = loaded_payloads.PayloadModule(cli_args)
return
示例10: _load_cookies
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def _load_cookies():
"""
从设置中解析cookies
:return: dict
"""
if settings.COOKIES == 'AUTO':
with WeiboBrowser() as weibo:
return weibo.get_cookies()
assert settings.COOKIES, '请在`settings.py`中粘贴cookies'
return dict([l.split('=', 1) for l in settings.COOKIES.split('; ')])
示例11: format_vcenter_conn
# 需要导入模块: import settings [as 别名]
# 或者: from settings import py [as 别名]
def format_vcenter_conn(conn):
"""
Formats :param conn: into the expected connection string for vCenter.
This supports the use of per-host credentials without breaking previous
deployments during upgrade.
:param conn: vCenter host connection details provided in settings.py
:type conn: dict
:returns: A dictionary containing the host details and credentials
:rtype: dict
"""
try:
if bool(conn["USER"] != "" and conn["PASS"] != ""):
log.debug(
"Host specific vCenter credentials provided for '%s'.",
conn["HOST"]
)
else:
log.debug(
"Host specific vCenter credentials are not defined for '%s'.",
conn["HOST"]
)
conn["USER"], conn["PASS"] = settings.VC_USER, settings.VC_PASS
except KeyError:
log.debug(
"Host specific vCenter credential key missing for '%s'. Falling "
"back to global.", conn["HOST"]
)
conn["USER"], conn["PASS"] = settings.VC_USER, settings.VC_PASS
return conn