[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: In python app, how to get DB environment variable?



Thanks for reply.
But not work.
In my case, when I use "export" command via ssh into the app, I can see some variable like "OPENSHIFT_MYSQL_DB_USERNAME".
And when I open python shell into the app, I can get the "OPENSHIFT_MYSQL_DB_USERNAME".

But in application file(raw python) or views.py file, "os.environ["OPENSHIFT_MYSQL_DB_USERNAME"]" cant find the variable.
And I look url/env on browser, the "OPENSHIFT_MYSQL_DB_USERNAME" is missing!!!


2014-03-07 14:38 GMT+08:00 Steven Citron-Pousty <spousty redhat com>:
Here is an example of what I use

https://github.com/thesteve0/openshift-mongo-flask-example/blob/master/wsgi/myflaskapp.py


From: "Zilu Yuan" <yuanlukeyuan gmail com>
To: users lists openshift redhat com
Sent: Thursday, March 6, 2014 10:27:27 PM
Subject: In python app, how to get DB environment variable?



Hi,
the problem I suffer both in Openshift Online and in Openshift Origin

I create a python application, django or raw python. Then I create DB such as MySQL or Mongo.

And then I want to get the DB environment variable.

So I write some code like "os.environ.get("OPENSHIFT_MYSQL_DB_USERNAME")" or "os.environ["OPENSHIFT_MYSQL_DB_USERNAME"]" in views.py(dajngo) or application(raw python). It not work.

How can I do it?

_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users




--
袁子路  ZILU YUAN

中山大学 软件学院
School of Software,
Sun Yat-Sen University,
Guangzhou , 510006
China

Mobile: 13570367544

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]