I am building a web app where I'd like to use GWT for generating the java script that runs in the browser but because I use other python packages (specifically scipy) I would like for the web server to be python (not a servlet engine). Has anybody done so ? Any pointers would be appreciated.
Thank you.
Ranga
GWT is a front-end framework. You can use any backend technologies, whether it is Python, PHP, Java, Node.js or any Server-side technologies. There is no limitations on this. I haven't use GWT for quite long now, You have the request builder to fetch data from the server.
Anyway, the simplest solutions that gonna scale for wide range of your devices is to build a REST API on the backend with python, its very simple, you have many simply python technologies like Bottle or Flask that does it in a giffy for you. Build your backend and make it follow REST conventions.
Then, on the level of GWT, it has to have something for fetching data from the webserver. I'll advise to make your data in JSON and then you'll be able to use technologies like GSON to convert your JSON serialised string into Java objects on the fly
Pyjamas looks like it was originally a port of GWT to Python:
https://wiki.python.org/moin/Pyjamas
This guy doesn't like it though, so you might consider the cons to doing this as well:
http://blog.pyjeon.com/?p=302
Related
Please, Can somebody help me. I need to do cross-platform app based on flutter as frontend, and there is problem with backend. I know python very well and I want use it for my app as backend. Is it possible to use python(backend) for flutter(frontend)?
And I just started to learn flutter and don't knowing the Dart language.
Yes, you can
you can make the front end and UI of your app with flutter/dart, then you can make a backend with whatever language and technologies you want, such as node js, python, go, travel...
then you can link it and use it in your app using a REST API.
Frontend and backend technologies are independent. You can use any server side language(back end) to connect with Flutter. server side languages(back end) are just going to provide information using API. I have been working Flutter with nodejs,Flutter with java. It's upto you
Could you give me an idea/concepts (not in code) on how could I link NodeJS and Python?
Let's say,
I have NodeJS up and running in PM2 (assuming I already know REST API) and I have a ton of data sets that I need to be ready to display to client side using socket.io (assumming I already know socket.io) as soon as possible.
I'm thinking to use Python. This is for me to implement the basics of machine learning.
In what concept should I start? I'd really love to hear your ideas.
Well you seem to be assuming way too many things, okay from your description I would suggest you to have a look at concept called microservice architecture.
This is how it will work let us assume you want to build an online shopping application where you have 2 main scenarios first is sell all items on your website and second you want to recommend products to your user(Your ML comes into play over here)
So as you said you already know REST API so what you would do is create a microservice (Consider it as a small nodejs application(Using either express or sails or any other framework) which has APIs exposed for all shopping related business logic) also you end up using fromtend technology viz. angularjs for your client side code. You'll show all this shopping stuff by calling your nodejs REST APIs from your angularjs client code. Node provides socket support via socket.io.
Similarly you write a small microservice in python(using Flask and Python-SocketIO) which takes your huge amount of data from datastore does all ML magic and returns recommended products for the particular user(which you received from your angularjs client application), and return it using Python-SocketIO to angularjs(or node application if you're maintaining your frontend logic there instead of angular).
You have provided very less detail so this is abstract view of what you can look into.
Since you're Python oriented for your ML code I'd suggest you to reduce the list of skills you need to learn and/or improve using Python for everything.
You could use Python-SocketIO and Flask, for example.
I have a API server which is written in python.
And I wanted to render my react components on server side.
So I searched the best practices and result was having a nodeJS server.
But in my thoughts, this is weird because I have to build a another server with different language. This is bad at maintainable, and maybe have an overload.
So I want to know having nodeJS server is usual. and also how do big companies do server-side rendering.
If it is as simple as wanting to use Python with React, you can use python-react to render React components.
As noted above, if you are using Flask, the templating is in Jinja2, but that isn't necessarily mutually exclusive to using React in your project.
This resource on using Flask/React may be of use to you, as well.
I need to implement a JSON-RPC server like this:
http://pasha.cdemo.applicationcraft.com/service/json
This server will be accessed from jQuery and I have to use Python for writing it.
What library should I use? Can you also give me an example of using that library?
Thanks.
I found cherrypy very easy to use (doesn't come with a predefined template engine or a database model, so it's IMO better than others when your server is producing json and is not a typical database).
Coupled with nginx and memcached can also be quite performant...
Python 2.6 comes with json module in the standard library which allows you to effective convert Python data structures to JSON responses.
For HTTP communications and request handling, you can use Python web frameworks like Pyramid, Django or HTTP server software like Tornado. It really much depends what do you need to process in your JSON-RPC calls.
I am trying to explore more about web service in Python/Django and to be honest i am quite confused. There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented in live production environment
There isn't a 'standard' way, but a lot of people (including me) have used -- and like! -- Django Piston, which is actually also used to create the web service for BitBucket (where piston's source is hosted)
Also, if you're still learning about web services, I can highly recommend the O'Reilly book RESTful Web Services -- although it's a book with a focus on REST (which I agree is the best design pattern for a web service) it also explains RPC and SOAP, too.
There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
This should give you a clue - there are different services out there that use one or more of these mechanisms.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented in live production environment
There is no single standard way of implementing a web service. This is as true for Django/Python as for other web frameworks.
Different people have used Django in different ways to create a web service to suit their needs.