Home | History | Annotate | Download | only in dashboard
      1 # Copyright 2015 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """App Engine config.
      6 
      7 This module is loaded before others and can be used to set up the
      8 App Engine environment. See:
      9   https://cloud.google.com/appengine/docs/python/tools/appengineconfig
     10 """
     11 
     12 import os
     13 
     14 from google.appengine.ext import vendor
     15 
     16 import dashboard
     17 
     18 # The names used below are special constant names which other code depends on.
     19 # pylint: disable=invalid-name
     20 
     21 appstats_SHELL_OK = True
     22 
     23 # Allows remote_api from the peng team to support the crosbolt dashboard.
     24 remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (
     25     'LOAS_PEER_USERNAME', ['chromeos-peng-performance'])
     26 
     27 # pylint: enable=invalid-name
     28 
     29 def _AddThirdPartyLibraries():
     30   """Registers the third party libraries with App Engine.
     31 
     32   In order for third-party libraries to be available in the App Engine
     33   runtime environment, they must be added with vendor.add. The directories
     34   added this way must be inside the App Engine project directory.
     35   """
     36   # The deploy script is expected to add links to third party libraries
     37   # before deploying. If the directories aren't there (e.g. when running tests)
     38   # then just ignore it.
     39   for library_dir in (dashboard.THIRD_PARTY_LIBRARIES +
     40                       dashboard.THIRD_PARTY_LIBRARIES_IN_SDK):
     41     if os.path.exists(library_dir):
     42       vendor.add(os.path.join(os.path.dirname(__file__), library_dir))
     43 
     44 
     45 _AddThirdPartyLibraries()
     46 
     47 # This is at the bottom because datastore_hooks may depend on third_party
     48 # modules.
     49 from dashboard import datastore_hooks
     50 datastore_hooks.InstallHooks()
     51