Cant fetch production db results using Google app engine remote_api

Posted by Alon on Stack Overflow See other posts from Stack Overflow or by Alon
Published on 2010-04-25T15:13:26Z Indexed on 2010/04/25 15:23 UTC
Read the original article Hit count: 192

Filed under:
|
|

Hey, im trying to work out with /remote_api with a django-patch app engine app i got running.

i want to select a few rows from my online production app locally.

i cant seem to manage todo so, everything authenticates fine, it doesnt breaks on imports, but when i try to fetch something it just doesnt print anything. Placed the test python inside my local app dir.

#!/usr/bin/env python
#
import os
import sys

# Hardwire in appengine modules to PYTHONPATH
# or use wrapper to do it more elegantly
appengine_dirs = ['myworkingpath']
sys.path.extend(appengine_dirs)
# Add your models to path
my_root_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, my_root_dir)

from google.appengine.ext import db
from google.appengine.ext.remote_api import remote_api_stub
import getpass


APP_NAME = 'Myappname'
os.environ['AUTH_DOMAIN'] = 'gmail.com'
os.environ['USER_EMAIL'] = '[email protected]'

def auth_func():
 return (raw_input('Username:'), getpass.getpass('Password:'))

# Use local dev server by passing in as parameter:
# servername='localhost:8080'
# Otherwise, remote_api assumes you are targeting APP_NAME.appspot.com
remote_api_stub.ConfigureRemoteDatastore(APP_NAME,
 '/remote_api', auth_func)

# Do stuff like your code was running on App Engine
from channel.models import Channel, Channel2Operator

myresults = mymodel.all().fetch(10)
for result in myresults:

 print result.key()

it doesnt give any error or print anything. so does the remote_api console example google got. when i print the myresults i get [].

© Stack Overflow or respective owner

Related posts about appengine

Related posts about python