forked from django-nonrel/djangoappengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
21 lines (18 loc) · 831 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from google.appengine.api import apiproxy_stub_map
from google.appengine.api.app_identity import get_application_id
import os
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = get_application_id()
else:
try:
from google.appengine.tools import dev_appserver
from .boot import PROJECT_DIR
appconfig = dev_appserver.LoadAppConfig(PROJECT_DIR, {},
default_partition='dev')[0]
appid = appconfig.application.split('~', 1)[-1]
except ImportError, e:
raise Exception('Could not get appid. Is your app.yaml file missing? '
'Error was: %s' % e)
on_production_server = have_appserver and \
not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel')