How to use Django ORM with cloud NDB? - django

I am trying to create an django project in which database is handled by cloud NDB. I checked out the cloud ndb documentation here and it only specifies the middleware that I need to include in my settings.py file. I want to use django ORM facility but I don't know how to do that with cloud NDB. I don't even know if I can use it so any answers are welcome.
Thank you for help.

Related

Displaying data retrieved through GraphQL in a Django website

(Disclaimer : I'm just getting started with Django, and with web dev in general)
I have a backend app that stores different kinds of resources. Some are public and some are private. The application is accessible only to identified users. A GraphQL API allows me to access the resources.
On another server, I'd like to create a website that will be accessible to everyone. I want to use Django to create it.
The website will display a list of resources tagged as "public" in the backend app, with a pagination system and, say, 20 resources by page. The CSS will differ from the backend app and there will be a search section.
From what I understand, I should be able to retrieve the data through the GraphQL API, but I'm a bit confused here. All the documentation and tutos I can find about Django and GraphQL seem to be about setting up a GraphQL API server with Django. All I want to do is to build custom queries and to display them on my different html pages.
How can I do that? Where should I start?
You should connect your project with a GraphQL client. As per my research, I have found that there are implementations and examples for graphene-mongoengine in Flask (Flask has a direct GraphQL client).
Mongoengine Flask with GraphQL Tutorial
For Django you can check this out
Edit- I was able to get the data from my database with python-graphql-client. Now I am able to display them in my template.
Let me know if this helps

How to Store images in Django deployed on Google App engine?

I have just started using GAE and can't figure out how to store images.
I created Django project and deployed on GAE using the methodology in this
tutorial which use cloud SQL (my project uses MySQL)
Now I want to add a Django model for images. I can't figure out how to go about it. I used AWS extensively earlier and stored links in MySQL database while filing on buckets.
Do I need to use google cloud storage? What is the GAE way to do it?

How to use API Auth using Django MongoEngine REST?

I'm building an API REST using Django and MongoDB with django-rest-framework-mongoengine package from https://github.com/umutbozkurt/django-rest-framework-mongoengine
How can I use Django Rest Framework API TokenAuthentication if this package does not use Django's built in ORM ?
I solve it by handling TokenAuthentication or any other type of DRF auth using Django's build in ORM with MySQL database (Just to handle API authentication). I use MongoDB as my primary system database. So yes, i'm using two databases, one for auth API and the other for transactions.
Don't know if this is the best way to achieve this but it works.
I hope this helps to anyone who's trying or thinking to work with this architecture :)

Google App data store and GQL in Django

Is there a way to use GQL and Google App engine data store with Django? If yes then how to use it, I have searched on web but I am unable to find any satisfying answers to this problem?
In case of both cloud-sql and django-nonrel we dont use GQL as query language. They use SQL and MySql. But I wanted to use GQL in Django. So when I looked at documentation of Google app data store and GQL for google app engine webapp2 I found out that it has nothing to do with webapp2, instead it was for python. So only thing which I changed to make it working for Django was the method of rendering the request.

How to integrate social-auth in my project

I want to use social-auth to provide registration/authentication via social network sites. I have been trying to understand how to use social-auth, but I have been unable to get beyond installing dependencies and configuring backends.
I am basically new to Django and I have tried hard to understand before posting on the forum. Maybe because I am not very familiar with it that is why I have been unsuccessful. Can anybody please point me to a tutorial on how to use social-auth. This will also help me in integrating other apps.
Update:
Although the answer given below solved my problem, I just want to share that I ended up using django-allauth instead of social-auth. And the latest version of django-allauth appears to be the best Django authentication app.
It's somehow unclear from documentation.
You need to create apps in Twitter/Facebook/whatever you want to use.
If you want twitter see: https://dev.twitter.com/apps/new
If you want facebook: https://developers.facebook.com/apps
They will give you api key and api secret.
Follow these basic steps that refer to socialauth docs:
pip install
add social-auth to installed apps
copy AUTHENTICATION_BACKENDS
fill api key and api secret
add social auth url patterns
configure authentication and association complete URL names (SOCIAL_AUTH_COMPLETE_URL_NAME)
context processor
syncdb
Now, what the documentation doesn't tell you, is to put links in your login template:
Login with Twitter
Should work.