If you're using MongoLab as a backend, is using the API an option - 
http://docs.mongolab.com/data-api/
I've used this with Java apps on GAE without any problems

On Wednesday, 4 November 2015 07:39:17 UTC, Minie Takalova wrote:
>
> Hello
>
> I'am trying to build application on GAE which use MongoDB hosted at 
> Mongolab provider.
> Connection work, if I made new connection every request, but if I want to 
> reuse once established connection, GAE freeze and die on timeout.
> I believe that exist some simple way, how to do that such simple task.
>
>
> -----  This is woring, but open new connection every request: ------
> def get_database_connection():
>     client = pymongo.MongoClient(MONGO_URI)
>     DBCONN = client.get_default_database()
>     return DBCONN
>
> DBCON = get_database_connection()
>  ... do something usefull with DBCONN ...
>  ... not store connection anywhere ....
>  ... end request ....
>
>
> ---- This freeze GAE and die on timeout ---
> def get_database_connection():
>     if "DBCONN" in globals():             # look for open connection in 
> instance memory
>         return globals()["DBCONN"]
>     client = pymongo.MongoClient(MONGO_URI)
>     DBCONN = client.get_default_database()
>     globals()["DBCONN"] = DBCONN  # store connection to instance memory
>     return DBCONN
>
> DBCONN = get_database_connection()
>  ... do something usefull with DBCONN ...
>  ... end request .... 
>
> --------
>
> Probably GAE module with backend thread can be uset to keep connection 
> open in separate thread, but after many hours I canĀ“t find working solution.
> Hope somebody can experience with this usecase and can help me. Also link 
> to well-tried solution will be helpfull. 
>
> Have a nice day.
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/5fcecee3-4209-4eb2-a237-4f1bd98e65f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to