milesrichardson / ParsePy

A relatively up-to-date fork of ParsePy, the Python wrapper for the Parse.com API. Originally maintained by @dgrtwo
MIT License
515 stars 184 forks source link

parse-py not pointing to the self-hosted server #159

Closed myopicdoll closed 7 years ago

myopicdoll commented 7 years ago

Even after setting the env var parsePy doesn't seem to be pointing to self-hosted server based on logs.

root = config.get('parse-db-prod', 'uri_root')
os.environ["PARSE_API_ROOT"] = root

print os.environ.get("PARSE_API_ROOT") # shows the right uri

in a long running batch job it spits out this error:

parse_rest.core.ParseError: {"code":2,"error":"the service is currently unavailable"}

milesrichardson commented 7 years ago

Hi

You must set the environment variable before importing any ParsePy modules (either above your import statements, or within your environment before calling the script).

Hope that helps

myopicdoll commented 7 years ago

Thanks! That worked like a charm. I was importing a couple error stuff from ParsePy query prior to setting the environment variable.