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


Python settings.GOOGLE_API_KEY屬性代碼示例

本文整理匯總了Python中django.conf.settings.GOOGLE_API_KEY屬性的典型用法代碼示例。如果您正苦於以下問題:Python settings.GOOGLE_API_KEY屬性的具體用法?Python settings.GOOGLE_API_KEY怎麽用?Python settings.GOOGLE_API_KEY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在django.conf.settings的用法示例。


在下文中一共展示了settings.GOOGLE_API_KEY屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import GOOGLE_API_KEY [as 別名]
def setUp(self):
        self.region = "Somerville, MA"
        self.addresses = ["240 Elm Street", "100 Broadway", "115 Medford Street"]
        self.geocoder = gmaps.GoogleGeocoder(settings.GOOGLE_API_KEY)
        self.proposal_importer_url = "https://58kr1azj04.execute-api.us-east-1.amazonaws.com/prod/somervillema" 
開發者ID:codeforboston,項目名稱:cornerwise,代碼行數:7,代碼來源:tests.py

示例2: get_context_data

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import GOOGLE_API_KEY [as 別名]
def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        if settings.GOOGLE_API_KEY:
            context['GOOGLE_API_KEY'] = settings.GOOGLE_API_KEY
        return context 
開發者ID:opentaps,項目名稱:opentaps_seas,代碼行數:7,代碼來源:common.py

示例3: get_site_addr_loc

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import GOOGLE_API_KEY [as 別名]
def get_site_addr_loc(tags, site_id, session):
    show_google_map = False
    addr_loc = None
    site_address = ""
    allowed_tags = ['geoCity', 'geoCountry', 'geoPostalCode', 'geoState', 'geoStreet', 'geoAddr']
    geo_addr = None
    if settings.GOOGLE_API_KEY:
        if tags:
            for tag in tags:
                if tag in allowed_tags and tags[tag]:
                    if tag == 'geoAddr':
                        geo_addr = tags[tag]
                        continue
                    if site_address:
                        site_address = site_address + ", "
                    site_address = site_address + tags[tag]
                    if tag == 'geoStreet':
                        show_google_map = True

        if not show_google_map and geo_addr:
            if site_address:
                site_address = site_address + ", "
            site_address = site_address + geo_addr
        show_google_map = True

        if site_address and show_google_map:
            hash_object = hashlib.md5(site_address.encode('utf-8'))
            hash_key = hash_object.hexdigest()

            if hash_key in session:
                addr_loc = session[hash_key]

            if not addr_loc:
                geo = geocoder.google(site_address, key=settings.GOOGLE_API_KEY)

                if geo.json and geo.json["ok"]:
                    addr_loc = {"latitude": geo.json["lat"], "longitude": geo.json["lng"], "site_id": site_id}
                    session[hash_key] = addr_loc

    return addr_loc 
開發者ID:opentaps,項目名稱:opentaps_seas,代碼行數:42,代碼來源:utils.py

示例4: analytics

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import GOOGLE_API_KEY [as 別名]
def analytics(request):
    return {"GOOGLE_API_KEY": settings.GOOGLE_API_KEY, "HOTJAR_TRACKING_KEY": settings.HOTJAR_TRACKING_KEY} 
開發者ID:jllorencetti,項目名稱:pets,代碼行數:4,代碼來源:context_processors.py

示例5: global_settings

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import GOOGLE_API_KEY [as 別名]
def global_settings(request):
    # return any necessary values
    return {
        'GOOGLE_ANALYTICS': settings.GOOGLE_ANALYTICS,
        'GOOGLE_API_KEY': settings.GOOGLE_API_KEY
} 
開發者ID:open-austin,項目名稱:influence-texas,代碼行數:8,代碼來源:context_processors.py

示例6: api_keys

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import GOOGLE_API_KEY [as 別名]
def api_keys(request):
    """
    Pass a `APIKEYS` dictionary into the template context, which holds
    IDs and secret keys for the various APIs used in this project.
    """
    return {
        "APIKEYS": {
            "GOOGLE": settings.GOOGLE_API_KEY,
            "GOOGLE_ANALYTICS": settings.GA_TRACKING_ID,
            "GOOGLE_ADWORDS": settings.ADWORDS_CONVERSION_ID,
            "GOOGLE_TAG_MANAGER": settings.GTM_CONTAINER_ID,
            "SMARTLOOK": settings.SL_TRACKING_ID,
        }
    } 
開發者ID:mitodl,項目名稱:micromasters,代碼行數:16,代碼來源:context_processors.py


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