简体   繁体   English

GraphQL / Graphene用于Django模板中的后端调用

[英]GraphQL/Graphene for backend calls in Django's templates

I just installed Graphene on my Django project and would like to use it also for the back-end, templating. 我刚刚在Django项目中安装了Graphene,并希望将其也用于后端模板。 So far, I find just tutorials how to use it only for front-end, no mention about back-end. 到目前为止,我只发现了有关如何仅在前端使用它的教程,而没有提及后端。

  1. Should I suppose that it is not a good idea to use it instead of a SQL database? 我是否应该认为使用它代替SQL数据库不是一个好主意? If yes, then why? 如果是,那为什么呢? Is there a downside in the speed in the comparison to a SQL databases like MySQL? 与MySQL数据库(如MySQL)相比,速度上有不利之处吗?

  2. What's the best option how to retrieve the data for templates in Python? 如何在Python中检索模板数据的最佳选择是什么? I mean, best for the performance. 我的意思是,最好的表现。

Thnx. 日Thnx。

  1. GraphQL is an API specification. GraphQL是API规范。 It doesn't specify how data is stored, so it is not a replacement for a database. 它没有指定数据的存储方式,因此不能替代数据库。

  2. If you're using GraphQL, you don't use Django templates to specify the GraphQL output, because GraphQL specifies the entire HTTP response from the web service, so this question doesn't make sense. 如果您使用的是GraphQL,则不要使用Django模板来指定GraphQL输出,因为GraphQL指定了来自Web服务的整个HTTP响应,所以这个问题没有意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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