1import os
2import functools
3
4live_connection = False
5mturk_host = 'mechanicalturk.sandbox.amazonaws.com'
6external_url = 'http://www.example.com/'
7
8
9SetHostMTurkConnection = None
10
11def config_environment():
12    global SetHostMTurkConnection
13    try:
14            local = os.path.join(os.path.dirname(__file__), 'local.py')
15            execfile(local)
16    except:
17            pass
18
19    if live_connection:
20            #TODO: you must set the auth credentials to something valid
21            from boto.mturk.connection import MTurkConnection
22    else:
23            # Here the credentials must be set, but it doesn't matter what
24            #  they're set to.
25            os.environ.setdefault('AWS_ACCESS_KEY_ID', 'foo')
26            os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'bar')
27            from mocks import MTurkConnection
28    SetHostMTurkConnection = functools.partial(MTurkConnection, host=mturk_host)
29