是否可以使用python支持的框架Django开发本机移动应用程序的后端? [英] Is it possible to develop the back-end of a native mobile app using the python powered framework Django?

查看:166
本文介绍了是否可以使用python支持的框架Django开发本机移动应用程序的后端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个在线移动应用程序。我正在考虑使用本机语言来开发前端,因此适用于Android的Java和适用于iOS的Objective-C。但是,对于后端,我可以使用类似Django的东西吗?

I want to develop a online mobile app. I am thinking about using native languages to develop the front-ends, so Java for Android and Objective-C for iOS. However, for the back-end, can I use something like Django?

我使用django已有一段时间了,但是教程确实很缺乏,所以有人可以指出我吗?可以帮助我理解如何在Java为Android设备开发的前端上显示Django模型处理的数据(也就是说,我想使用XML)。

I have used django for a while, but the tutorials are really lacking, so can anyone point me to something that will help me understand how to show data handled by Django models on a front-end developed by Java for an android device (that is, by using XML I suppose).

推荐答案

当然可以。移动应用程序(例如浏览器)只是客户端,或者特别是您可以将它们视为可以提供更自然外观的专用浏览器。

Of course you can. Mobile apps, like browsers, are just clients, or specifically you can think of them as specialized browsers that can give a more native look.

这实际上取决于哪种您要开发的移动应用程序,但您说过您想要本机移动应用程序。这意味着您的移动应用将使用某种Web API。有一个名为 Django REST Framework 的Django程序包可以为您提供帮助。

It really depends on what kind of mobile app you want to develop, but you said you want a native mobile app. This will mean your mobile app will consume a Web API of some sorts. There is a Django package called Django REST Framework that can help you with that.

基本上,在本机移动应用程序中,您将使用SDK随附的任何HTTP客户端来与Web API交互。 HTTP客户端向Web API发送请求,Web API(可以用Java / Python / Ruby等编写)然后处理该请求并返回响应。然后,该响应将由您的本机移动应用处理,以显示一些信息或消息或您想要执行的任何操作。

Basically, in a native mobile app, you will use whatever HTTP client the SDK comes with to interface with the Web API. That HTTP Client sends a request to Web API, Web API (can be written in Java/Python/Ruby etc) then processes that request and returns a response. That response will then be handled by your native mobile app, either to display some info or messages or whatever you want it to do.

在更个人化的注释上,我建议除非绝对必要,否则您将远离XML。 JSON在很多情况下就足够了,而且要简单得多。

On a more personal note, I recommend you stay away from XML unless you absolutely need to. JSON is enough for a lot of cases, and it is much much simpler.

这篇关于是否可以使用python支持的框架Django开发本机移动应用程序的后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆