以Django为后端的Android/iOS应用 [英] Android/iOS app with Django as backend

查看:602
本文介绍了以Django为后端的Android/iOS应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Django构建的网站项目,并希望为其构建一个移动应用程序.我做了很多研究,但在nativehybrid应用程序之间感到困惑.我的项目基本上是Quora克隆,而只是一个大学项目.我还看到了PhoneGapIonicSencha,但是我对它们的适合程度感到非常困惑.我是否必须将IonicPhoneGap或Apache Cordova或仅与Ionic一起使用?什么是结构,我应该从哪里开始?

I have a website project built in Django and want to build a mobile app for it. I did a lot of research but was confused between native and hybrid app. My project is basically a Quora clone and just a college project. I also saw PhoneGap, Ionic and Sencha but I am really confused about how they all fit. Do I have to use Ionic with PhoneGap or Apache Cordova or just Ionic? What is the structure and where should I start?

推荐答案

TL; DR :以离子.爱奥尼(Ionic)在幕后使用科尔多瓦(Cordova).不需要PhoneGap或Sencha,所以不要为此感到困惑.

TL;DR: Start with Ionic. Ionic uses Cordova "under the hood". No need for PhoneGap or Sencha, so don't be confused by that.

免责声明:这听起来像是广告,所以我不得不说我与Ionic无关,我只是非常喜欢它,以至于我都分享着对它的热爱.

让我们一步一步地完成这项工作:

Let's take this one step by step:

什么是离子性

Ionic是一个用于构建混合移动应用程序的框架,它建立在一个以Angular作为Web应用程序框架的生态系统中,并使用Cordova来构建和打包本机应用程序. Ionic创建了一个本地移动应用程序,可以通过应用程序商店安装该应用程序,其中包含所谓的WebView(本质上是一个隔离的浏览器窗口),以及一个将在其中运行该Web应用程序的JavaScript API.

Ionic is a framework for building hybrid mobile apps, and it's built on an ecosystem that includes Angular as the web application framework and uses Cordova for the building and packaging of the native app. Ionic creates a native mobile app that can be installed via the app stores, and contains what is called a WebView (essentially an isolated browser window) with a JavaScript API inside which the web application will run.

什么是混合移动应用?

如果您是一名Web开发人员,那么您将对HTML,CSS和JavaScript有所了解.而且,您最有可能使用像AngularJS这样的如今流行程度稍低的框架之一.直到最近,如果您要为(当前)两个最受欢迎的移动操作系统iOS和Android制作应用程序,唯一的选择就是使用目标平台的SDK制作所谓的本地应用程序本身.当然,这意味着您需要制作两个版本的应用程序-iOS和Android.如果您是一个单独的开发人员,那么精通两者的机会就不会那么高.

If you're a web developer, you have a decent knowledge of HTML, CSS and JavaScript. Also, you're most likely using one of the ever so slightly popular frameworks these days like AngularJS. Up until fairly recently if you wanted to make an app for (currently) two most popular mobile operating systems iOS and Android your only bet was to make the so-called native applications using the SDKs of the intended platform itself. This, of course, meant that you needed to make two versions of your application - both for iOS and Android. If you are a solo developer chances that you're proficient in both are not so high.

幸运的是,如今,借助Ionic Framework,您可以通过使用Web开发人员已有的技能来创建一个应用程序,然后将此一个代码库作为应用程序部署到iOS和Android商店.那有多酷,对吗?因此,将其混合,因为它是一个用所谓的WebView包装在本机应用程序中的简单" Web应用程序.

Nowadays, luckily, with the Ionic Framework you can create one application by using the skills you already have as a web developer and then deploy this one codebase as an app to both iOS and Android stores. How cool is that, right? So, hybrid because it's a "simple" web app wrapped inside the native app with a so-called WebView.

为什么离子酷?

Ionic非常棒,因为它不只是框架".相反,它具有围绕它构建的整个生态系统.例如,Ionic允许您:

Ionic is awesome because it's not "just" a framework. Instead, it has a whole ecosystem built around it. For example, Ionic allows you to:

  • 通过单个命令ionic resources为所有设备和设备尺寸生成图标和启动屏幕.仅此一项,您就可以节省至少一天的时间准备各种尺寸的图像.
  • 即使使用ionic run --livereload
  • 直接在设备上运行,也可以通过代码更改立即更新您的应用
  • 并排构建和测试iOS和Android版本,并使用ionic serve --lab
  • 立即查看更改
  • 与世界各地的客户,客户和测试人员共享您的Ionic应用程序,而无需通过ionic share
  • 遍历App Store.
  • 使用ngCordova轻松访问设备的完整本机功能(在这里您可以使用任何Cordova插件-因此,Ionic的确比Cordova本身具有更多的优势)
  • 此外,他们(离子团队)正在为您的离子应用构建完整的后端服务和工具,例如与Angular 2.0团队紧密合作.
  • generate icons and splash screens for all devices and device sizes with a single command: ionic resources. This alone saves you at least a day of image preparing for various sizes.
  • instantly update your apps with code changes, even when running directly on your device with ionic run --livereload
  • build and test iOS and Android versions side-by-side and see changes instantly with ionic serve --lab
  • share your Ionic apps with clients, customers, and testers all around the world without ever going through the App Store with ionic share
  • easily accessing the full native functionality of the device using ngCordova (here you get to use any Cordova plugin - so Ionic is indeed much more than Cordova per se)
  • Also, they're (Ionic team) building a full-stack backend services and tools for your Ionic app like Deploy (for deploying a new version without going through Apple review process!), Analytics, Push notifications.
  • Ionic CLI (command line interface) uses Cordova in the backend and allows you to build (directly using Ionic CLI) apps for iOS and Android (you by doing ionic build ios or ionic build android and woila)
  • Ionic uses Angular as a frontend framework so if you're familiar with it it will come as a bonus. They're working closely with the Angular 2.0 team too.

如何开始您的项目?

如果您看看我对这个问题的回答,您会看到,如果您已经在Django后端中定义了一个API,那么您可以通过利用现有API并将其与Angular

If you take a look at my answer to this question you'll see that if you already have an API defined in your Django backend, then you can start using it quite quickly by leveraging the existing API and consuming it with Angular $resource.

希望这会有所帮助,并且您会发现使用Ionic是一种乐趣.

Hope this helps and that you find using Ionic a pleasure.

这篇关于以Django为后端的Android/iOS应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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