简体   繁体   中英

Use Django with Parse.com

I'm working on a django website which will have an equivalent app.We figured with my team that we should use Parse.com so as to have a single "database" for the two implementations.

Now here comes a dilemma. Django have a beautiful ORM and some great apps which can help with lot of things. So it would be fantastic if i could use Django-ORM but i can't find a way to achieve that using Parse.com as my database. I came across Django-ROA but i really can't figure out how to make it works.

What is good way to handle the problem ? Or if anyone knows how to make Django-ROA work with a BaaS like Parse, i'll be thrilled to hear it.

Thank you in advance !

EDIT :

If i can't use anything that could enable me to use django session features i will keep using ParsePy. Basically at signup/login, user informations will be stored on Parse.com and any user authenticated will be redirected to a dashboard where he can see his profile information, and when he goes on the store he has to be recognized as a registered user...etc What would be a secure way to achieve that ? Signed cookies ? Certificates ? I'm all ears.

I've finally ended up using ParsePy. But i set up a db in Django just to handle sessions server side. That's what i would recommend for any django user who uses Parse.com. You can't have Django ORM but ParsePy looks good. Store Parse session token with Django implemented session logic (very simple to use) and you're good to go. Other security measures include setting Https and SSL on your website domain.

EDIT : little more explanation on how to achieve this

So you've got to enable django sessions thru your django settings. Then you want to store the current Parse user sessionToken in the django session. So somewhere in your custom login view you'd do something like this: ```

request.session['ParseSession'] = parse_logged_user.sessionToken

From now on anytime you want to retrieve current user info, you'd do something like this:

from parse_rest.connection import SessionToken
with SessionToken(request.session['ParseSession']):
    current_user = User.current_user()

This is the most straightforward way to accomplish this. Hopefully you'd end up writing a middleware to do this and also check for the session key availability.

Why don't you use the Python client for the Parse REST API provided by Parse.com? Here is link for you. https://github.com/dgrtwo/ParsePy

Hope it works. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM