當前位置: 首頁>>代碼示例>>Python>>正文


Python settings.py方法代碼示例

本文整理匯總了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 
開發者ID:superdesk,項目名稱:superdesk,代碼行數:19,代碼來源:app.py

示例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 
開發者ID:Veil-Framework,項目名稱:Veil,代碼行數:11,代碼來源:orchestra.py

示例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 
開發者ID:Veil-Framework,項目名稱:Veil,代碼行數:11,代碼來源:orchestra.py

示例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 
開發者ID:Veil-Framework,項目名稱:Veil,代碼行數:13,代碼來源:orchestra.py

示例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 
開發者ID:Veil-Framework,項目名稱:Veil,代碼行數:9,代碼來源:tool.py

示例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 
開發者ID:Veil-Framework,項目名稱:Veil,代碼行數:14,代碼來源:ordnance_helpers.py

示例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) 
開發者ID:freyta,項目名稱:7Eleven-Python,代碼行數:32,代碼來源:app.py

示例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)) 
開發者ID:GreatSCT,項目名稱:GreatSCT,代碼行數:7,代碼來源:Tool.py

示例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 
開發者ID:GreatSCT,項目名稱:GreatSCT,代碼行數:10,代碼來源:Tool.py

示例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('; ')]) 
開發者ID:Lodour,項目名稱:Weibo-Album-Crawler,代碼行數:12,代碼來源:api.py

示例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 
開發者ID:synackray,項目名稱:vcenter-netbox-sync,代碼行數:33,代碼來源:run.py


注:本文中的settings.py方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。