Get and set data on Google App Engine - python

How can I store some data on Google App Engine? I'm using Django.

Assuming you don't want to just write web form pages to do this, you might want to take a look at http://code.google.com/appengine/docs/python/tools/uploadingdata.html which explains a few different ways to import/export data from the appengine datastore.

You can use google app engine helper. Django cannot understand google app engine so you can use this helper to make the Django understand app engine and you are good to go..
http://code.google.com/p/google-app-engine-django/

Related

How to only run Google App Engine cronjobs in Django if the caller is the Google App Engine?

I have been deployed my Django project to the Google App Engine. I wanna add cronjobs to my Django project and there is a cool feature for it in Google App Engine.
If I understand it well, I must create GET functions for my cronjobs in my views.py. But how do I make them callable only by the App Engine and no one else? Or, maybe there is a better solution for cronjobs in Django?
You can validate your request by checking header X-Appengine-Cron at your endpoint. This header is only supplied when your endpoint is triggered by GAE cron jobs.
Reference link:
https://cloud.google.com/appengine/docs/standard/python3/scheduling-jobs-with-cron-yaml#validating_cron_requests

How can I write to another Google App Engine app?

How can I connect multiple Google App Engine apps to my one Django app engine service so that I can write to another apps datastore? Is this even possible?
Directly accessing an app's datastore from another application is possible (you don't really need to write to the app itself for that!)
The fact that the other app is also a GAE app or not doesn't really matter, setting up the access control and accessing the respective datastore are the same.
I captured the details in How do I use Google datastore for my web app which is NOT hosted in google app engine?
If you don't want to give direct datastore access to the outside app then you could implement an inter-app communication protocol to achieve what you want:
the app owning the datastore would act as a server for the other apps and would perform itself the datastore accesses on their behalf
the other apps would be clients, sending requests to the server app to get it to perform the desired actions
With this approach you can implement any access control/restriction scheme you want on the server side, which is not really possible with the direct datastore access method.

Using Flask-OpenID in App Engine

I am trying out Flask-OpenID in App Engine. Flask-OpenID uses a 'store' to save authentication information. If I mention '/some/path' to save data, it doesn't work in App Engine, as it is read-only.
For Flask-OpenID to work, I have to write my own 'store' which uses App Engine's datastore or cloud storage. I have not much idea on how to write this store. Is there any document available, so that I can follow. It will be helpful if I get any input on writing the 'store' using Flask and App Engine.
Disclaimer: I am not the author of the framework, but I am using it everyday. You can start with gae-init which is a working example using Flask-OAuth for authentication. Login and other goodies are provided out of the box, and you can get an overview about it and educate yourself at docs which are still under construction.

google appengine datastore client

Is there a tool/client to view inside and make queries for google appengine datastore?
Starting with release 1.1.9 of the App Engine SDK, however, there's a new way to interact with the datastore, in the form of the remote_api module. This module allows remote access to the App Engine datastore, using the same APIs you know and love from writing App Engine Apps.
http://code.google.com/appengine/articles/remote_api.html
And some wrapper around it:
Today, I will share with you a simple script – remote.py – which can do all the necessary staging in order for us to talk with our App Engine back-end at Google. remote.py provides a single function attach(host), which will configure the API to communicate with the specified host. This will allow us to easily write scripts that interact with the live serving application, or if we need to, a newly-deployed version.
http://blog.onideas.ws/remote_api.gae
You can login at AppSpot and go to the "Datastore Viewer". You can run custom GQL queries and view/edit entities in the datastore.

How do you query the set of Users in Google App Domain within your Google App Engine project?

If you have a Google App Engine project you can authenticate based on either a) anyone with a google account or b) a particular google app domain. Since you can connect these two entities I would assume there is some way to query the list of users that can be authenticated. The use case is outputting a roster of all members in an organization to a web page running on Google App Engine. Any thoughts?
Querying all users that could possibly authenticate in the case of 'a' (all gmail users) would be millions and millions users, so I'm sure you don't expect to do that.
I'm sure you actually mean query the ones who have logged into your application previously, in which case you just create a table to store their user information, and populate that whenever an authenticated user is on your site.
You can read more in the Google App Engine Docs under Using User Values With the Datastore
There's nothing built in to App Engine to do this. If you have Apps Premium edition, however, you can use the reporting API.
You would have to use the Premium (or Education) Google apps version, and you can use the api to list all users in the apps domain:
GET https://apps-apis.google.com/a/feeds/domain/user/2.0
see docs here:
http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html
Yeah, there's no way to get information about people who haven't logged into your application.

Categories

Resources