Python framework choice - android

I know this is a bit off topic, but I really needed some help regarding this.
I am new to Python. I'm trying to build my next project (a dictionary web app which will have both iOS and android app as well) for myself in Python. I've done some research and listed out some promising frameworks.
django
pylons (pyramid + repoze.bfg)
tornado
CherryPy
pyjamas
flask
web.py
etc
But while django is great, it was originally built for newspaper like sites project building. Im stuck with choice making for dictionary like web application which will have to provide RESTful web service api for mobile request handling.
So anyone can you please help in pointing out which framework is the best choice for this type of web app. I think I should go with django. Or should I go with native python coding? Any suggestions will be great.

Django's strength is in it's ORM, huge documentation, and the thousands of reusable applications. The problem with those reusable apps is that the majority is written following Django's MVC design, and as you need a web service, and not a website or web application, most of those apps will be almost useless for you.
On the other hand, there is Django-REST-Framework, extending Django itself, which is pretty good, and it's declarative API feels as if it was part of Django itself. For simple cases just a couple lines of code could produce you a complete CRUD API following REST conventions, generating beautiful URLs, out-of-the box support for multiple authentication mechanisms, etc. but it could be an overkill to pick Django just because of that, especially if you do not wish to use it's ORM.
Flask on the other hand is pretty lightweight, and it's not an MVC-only framework, so in combination with Flask-RESTful, I think it would be an ideal tool for writing REST services.
So a conclusion would be that Django provides the best out-of-the-box experience, but Flask's simplicity and size is too compelling to ignore it.

Go with Django, ignore its entire templating system(used to generate web pages) and use Django-Tastypie for REST service. Easy to learn and set-up is instant.

Related

Android Application Backend from scratch

I am developing an android application which needs a backend to process login and store data remotely on a server. I have previously worked with a BaaS service "Parse" for android. but since this is my final year project for my university I need to develop a backend from scratch, I have never worked with web services. I need some guidance on how to approach this and which framework will be the best to work with.
Thanks in advance.
If I understand you correctly you want to build a server application that allows you query data from your android app?
I'm not an expert on this since i just started coding myself, but I did do some research and it seems to be a very viable option to implement a RESTful API on the server side. The wiki article is pretty specific about how it works.
If you can use PHP the slim framework allows you to get a scrappy prototype RESTful API up in less then an hour if you familiar with the server configuration. It seems to be sophisticated enough to drive small and medium sized projects (maybe even big projects; I can't tell to be honest.)
On the start page you can see an example that allows you to query for a "hello, world" string from the API with less then 50 lines of code.
http://www.slimframework.com/
Where the example returns a "hello world" string you would perform database queries using PHP and return your results as json objects to your client.
The benefits of this are that you can use this Backend for different clients: Android, iOS or even your own browser-based web application.
This also makes it easy replace / port the backend once requirements change since it's very easy to implement the same API using other technologies and languages that fit the requirements better.

Android app fetching Joomla website with DB

My client has Joomla website with plugins (Mosets tree and JSE events) that basically lists business an events. He wants an android app developed to fetch these info. Immidiately what came to mind, is I create php scripts that query the Database and I call those scripts from my app. In my app, I display the information collected.
Another idea that occurred to me, is to enable RSS feed and then I read this RSS feed.
Is my approach above the right approach? Is there a different way or standard way when developing apps that fetch information from the Joomla website backend?
Please note the website is already mobile friendly but the requirement is to create an app for part of the website. Any pointers are helpful
Building one or more PHP scripts that query the db and returns the data is definitely the faster and simpler solution.
If you want to build a more robust / compatible solution, you may extend your set of PHP scripts into a full blown REST API application. In that case take a look frameworks like SLIM or SILEX which are very good at this.
There are more complete and elegant solutions but they are probably overkill for your needs.
Edit: why query directly the database
In theory, it seems to be better to NOT access directly the database, and interact with the Mosets Tree component instead; because in that way you will not have to duplicate any logic.
But in my experience, with a very few exceptions, Joomla components are coded so that it's very hard to interact with them programmatically.
I answered a similar question regarding Joomla RESTful APIs here:
REST API for Joomla 3.0
Basically, I ended up developing a solution which meshes the Slim PHP micro-framework with the Joomla Framework / CMS (requires Joomla 3.4.3+).
Why?
Well, the main reason is that while using the Slim framework would be OK as a one-off solution, I realized that one would still need to develop all the accompanying ACL and access security, not to mention the actual CMS that might store and manage all the important data in the first place.
Basically, I did the work so you don't have to. Yes, it's a commercial component (must pay to download) but I think it's WELL worth it for what you end up getting out of it.
It's brand new, so the service routes in the cAPI ("Constant API") Core package are still limited, but those are being built-out over time (all included in the core package of course). The component/plugin/library package is architected to allow for easy integration of add-on plugins which will introduce new service routes to add functionality like RESTful JSON APIs for MySQL, MSSQL, MongoDB, LDAP, etc. I already use an alpha version of the LDAP add-on in a an enterprise environment, so I expect that to be available for purchase/download soon.
The point of all this is that you can use an existing Joomla site to drive mobile apps (with some development for Mosets), while taking advantage of built-in user management and ACL, along with token auth (via cAPI).
Let me know if you have any questions.

Web application + Mobile App Python/Django architecture

I'm starting a new side project in order to learn some new technologies and I have several doubts about the architecture I should use. My idea is developing an app both for web and for mobile (Android app mainly), so I think I need to implement the following:
REST API service (with django-rest-framework).
Web application (with django).
Android app.
After researching over stack overflow and Internet I have found 3 main "architectures" for the web part (server-rendering, client-rendering, and an hybrid model). In first place my idea was using the client-rendering model (with backbone or angular for the web client). However, I have seen that the hybrid model is a better choice.
So here are my doubts:
1) Could I use django for server-rendering the web application pages?
2) Does Django web app "use" the API or the API is implemented using the same "library" as the django web?
3) Could/should I use a client framework (angular, backbone) for the web client (being server-rendered) ?
Thanks in advance, and sorry about my short knowledge about django, etc.. This side project is just for that, to improve my knowledge about all this stuff.
I don't use Django but I am currently using Angular with Flask as my REST backend. I think the hybrid approach is useful if your app benefits from caching rendered content. An example would be something like a blogging site where you may store Markdown but render HTML and thus the content is largely unchanging. If this content is shared across many users it can be very beneficial to generate once on the server and serve it to many clients.
However if your reasoning is that because mobiles are relatively under-powered server-side rendering will improve the render time, this does not necessarily hold true. Serving the JSON data model will typically result in less network traffic (obviously dependent on browser caching) which is important for mobile client responsiveness.
For my own part I prefer to render on the client and keep the server-side rendering to some very minimal templates. I find this results in a much better REST API that I can then use to provide external developer access or plug in other client UIs. My client code lives on the client side in Angular, my REST interface is clean, and security is always uppermost in my mind because I have to assume that the client code is potentially hostile.
That said I can see a use for server-side rendering even with Angular. For content that is fairly static it would be great to generate this server side, cache it, and then ngInclude it.

Using content management system with iOS or Android

I want to develop a application where part of the data is dynamic like picture , show timing etc.Their are many content management system that use HTML5 and CSS but i want to also use the native iOS or Android Ui like the UISplitView for iPad.How is this possible ? whats the best way to manage and use dynamic data ?
I have been digging into this very exact answer. The best answer I can come up with is called parse.com. Which may not be 100% of what you are looking for. However. What it does is serve as a central database that talks to multiple platforms(windows 8, iOS, Android) and offers up an api for use with every platform with lots of documentation to make programming super easy. http://deployd.com/ also This site is something Ill be looking into which uses a simplified node.js desktop for programming easy objective based functions with a database. Definitely am still looking. Either way the bast thing is to call your view...bring in a few objects...and have these databases feed your objects to specifically answer your question.
As a developer Im used to Joomla and magento. These arent necessarily ios friendly. Anyway, best of luck.
I'd suggest taking a look at Cloud CMS (http://www.cloudcms.com).
Cloud CMS is a cloud content management system that is built around JSON schema. Unlike traditional web content systems, Cloud CMS works with JSON and binary files (either through MongoDB GridFS or Amazon S3). It provides full-text search, structured query and an entire suite of enterprise features for things like workflow, analytics, users and groups and more.
From an iOS or Android viewpoint, you really only need to interact with the REST API. You can do that directly or use one of the client libraries.
Disclaimer: I'm one of the founders of the company. Would love to find out what you think and learn what we can do to improve things. We're having a great time reinventing CMS for mobile.

How to create a full-featured Android app for a website?

This is my website: http://www.stustu.co.uk..
I want to create an app that can pull down the listings from this website and display the entries in the form I want; enable users to manage their online accounts conveniently within the app; post new entries. Basically, a similar app to Amazon and eBay.
But I've no clue about how to query the information from the website in the app...
The website itself is WordPress based (quite simple, therefore), and my initial thought was to find some API from WordPress. I did find the official WordPress app, which comes with the source code, but it helps little as its code mainly deals with blogging.
So here's my question:
What are the normal ways a web developer would use on the server side to achieve my aim?
Is that achievable for WordPress?
If not, are there workarounds?
I'm a new self-taught developer, sorry that the question is a bit broad.
The most common approach when you're trying to communicate between an app and a website is to use a web service. Popular architectures include using REST or SOAP to communicate with your server.
This video will teach you how to use REST interface properly on your Android application, while in this link you will find that using SOAP has its disadvantages over REST especially on Android(or mobile in general).
I personally recommend using REST APIs with responses in JSON format for your web service. Twitter did the right thing with their own rest api, and you can structure yours similarly.
Other links you will be finding useful as you develop your application:
google-gson
jackson JSON
http://blogs.developerforce.com/developer-relations/2011/02/rest-api-android-awesome.html
Sorry about not answering your question about Wordpress, as I never had the opportunity to use it. For my apology, have this potato.
How much experience do you have with android? If you have none you should go find the getting started tutorials on the developer site and complete a few of them to familiarize your self with the structure of an android application before you attempt something like this.
The next thing to consider is: does your site look and act nicely on mobile? If so do you want your application to simply be a dedicated browser that pulls up your site? Or do you want to create the entire application natively? In the latter case you'll have to build (or find) some sort of APIs that allow you to tie in to the functionality of your site from within the java in the application.
My experience is mostly on Android so I cannot suggest any strategies or examples for how you'd go about setting up your APIs. But I do know if you attempt to build something that sophisticated natively on android with little experience you'll likely get frustrated early.

Categories

Resources