GrapheneDB 인스턴스에 액세스하기 위해 Heroku를 통해 몇 가지 환경 변수를 설정했습니다. Heroku CLI 명령 heroku config
을 사용하면 모든 환경 변수가 예상대로 반환됩니다. 예를 들어os.environ.get()은 Heroku 환경 변수에 대해 None을 반환합니다.
, "heroku config"
반환 : 나는 이러한 환경 변수에 액세스 할 수 os.environ.get()
방법을 사용하려고하면
GRAPHENEDB_BOLT_PASSWORD: some_password
GRAPHENEDB_BOLT_URL: bolt://hobby-someletters.dbs.graphenedb.com:24786
GRAPHENEDB_BOLT_USER: appnumbers
GRAPHENEDB_URL: http://appnumbers:[email protected]:24789
NEO4J_REST_URL: GRAPHENEDB_URL
그러나, 세 가지 인쇄 문은 오히려 heroku config
반환하는 원하는 출력보다 None
을 반환합니다. 이것은 나에게는 Python 환경이 Heroku 환경 변수에 액세스 할 수 없음을 나타냅니다. 어떻게 파이썬에 액세스 할 수 있습니까?
import os
from py2neo import Graph
graphenedb_url = os.environ.get('GRAPHENEDB_BOLT_URL')
graphenedb_user = os.environ.get("GRAPHENEDB_BOLT_USER")
graphenedb_pass = os.environ.get("GRAPHENEDB_BOLT_PASSWORD")
print(graphenedb_url)
print(graphenedb_user)
print(graphenedb_pass)
나는 Acess Heroku variables from Flask 에서 솔루션을 사용하여 시도했지만 한 내가 명령을 수행 할 때 당신이 (env
또는 비슷한 이외의) 명령을 실행하기 때문에 heroku config:pull --overwrite
CLI를 config:pull is not a heroku command.