Open ghost opened 4 years ago
Hi @kiptoomm, We are waiting too for this approval, you can use our own flask-session fork instead.
You will need to set the following settings into the Flask application in order to use our fork:
'SESSION_TYPE' = 'datastore'
'GCLOUD_APP_PROJECT_ID': '<your_app_project_id>'
Best regards.
Hi @kiptoomm, We are waiting too for this approval, you can use our own flask-session fork instead.
You will need to set the following settings into the Flask application in order to use our fork:
'SESSION_TYPE' = 'datastore' 'GCLOUD_APP_PROJECT_ID': '<your_app_project_id>'
Best regards.
Thanks @alvarogf-vt, nice solution. With this implementation, how are the session objects stored? For example, with a mongodb backend, they're stored in a database called flask_session
and collection sessions
. We can access the objects thru mongo shell (command line). That is, I'm wondering what the datastore equivalents to the above are, if any.
Hey @alvarogf-vt, I also noticed/had a couple of issues/questions arising from https://github.com/alvarogf-vt/flask-session/commit/2162ca02a5b7ce57f52d06dbf868988bb1259465:
Did you mean to hard code your project id ('virustotal-***'), or shouldn't it be read in from the config variable GCLOUD_APP_PROJECT_ID
?
I had to set GOOGLE_APPLICATION_CREDENTIALS
env var to avoid google auth problems similar this SO post
How should this be used locally? Based on the commit linked above, I guess that we need to set a DATASTORE_EMULATOR_HOST
env variable. As exemplified in the official docs, I went ahead and set mine to something like:
export DATASTORE_EMULATOR_HOST=localhost:8432
However, it somehow interfered with my other calls to a remote instance of data store that I use for storing other values (that is, it looks like I cannot fetch my cloud datastore entities while using the datastore emulator) :(
Any advice on how to use your implementation locally would be greatly helpful.
Hi @kiptoomm
I meant you need to configure the Flask application as above:
import flask
app = flask.Flask(__name__)
app.config['GCLOUD_APP_PROJECT_ID'] = os.getenv('GCLOUD_APP_PROJECT_ID')
so you can pass GCLOUD_APP_PROJECT_ID as an os environment variable, this variable is needed in order to connect with your datastore instance once it has been deployed on Google cloud platform.
You can run your application with the google datastore emulator by executing dev_appserver.py
from the google cloud SDK with the datastore options
GOOGLE_APPLICATION_CREDENTIALS needs to be set in order to execute dev_appserver.py
locally, but the google internals tools know how to get project ID from this file, it could be interseting to investigate the way they have to do that in order not to require GCLOUD_APP_PROJECT_ID.
hey @fengsp, any chance to merge this any time soon?