I have a web application im currently working on in python. I'm using Django as my web framework currently. I intend to integrate real-time web features into the application using ajax push. However, I'm a bit confused as to what python based push server i should adopt. I've heard of a few of them, Orbited, Gevent, Tornado, but my main issue right now is that i'm a green horn when it comes to realtime web applications. I'd like to use python and i'd like a framework with good documentation.
A lot of people choose gevent for webapps with real-time features because of the speed, ease of use and a number of supporting packages.
Take a look at these packages:
gevent-socketio
django-socketio
and these tutorials:
Evented Django part one: Socket.IO and gevent
New and hot, part 4: Pyramid, Socket.IO and Gevent
Real-time Web Apps with Django and WebSockets
Hope this helps.
APE seems a cool thing.
I think it's not a problem to make it work with PDjango as a backend.
I think the most popular is tornado open-sourced by facebook. It also has pretty decent documentation.
Related
I'm looking to develop a web app that controls Concept2 rowing gym equipment connected to the users computer via USB. I'm trying to decide what approach I should take in developing something like this.
Control of these devices has been achieved in the past both in python:
(https://github.com/uvd/PyRow)
and using node/jQuery:
(https://github.com/tijmenvangulik/ErgometerJS).
An SDK and documentation is provided by the developers of Concept2 gym equipment. DLL and CSafe commands are used to interface with the machines monitors.
(https://www.concept2.com/service/software/software-development-kit)
I'm looking for recommendations on how I should this tackle this project. At the moment python seems like the best approach however I have no idea how I can run these python files through a website interacting with the java script front end.
Any advice or pointers is appreciated.
David
You task looks like a simple SCADA solution with web interface.
You choice depends on whether you have experienced developers, who are able to use modern frameworks like Vue.js, Angular, React and others or not.
Really, in your particular case - monitoring equipment over web, you don't necessary need to invest a lot in your front-end - depends on your target audience. Is it a single service engineer? If yes, probably your front-end should be minimalistic, you can use Python with Twisted for static web server and build your frontend on bootstrap plus jquery. This is a fast win solution and you can implement it even if you've never worked with web.
More complex approach, requiring more engineering, is Python + Flask.
If you feel ready for modern frameworks, like Vue, React, Angular, then, possibly, you'd better look at NodeJs as a backend. They are better integrated with NodeJs and its package manager npm. You will need it to build the project on your server side; also some people treat it as a solid solution, when using the same language (javascript) for both backend and frontend. As for me, it doesn't really matter a lot.
I saw bottle.py framework and found its awesome to use and works great.
But can it handle the huge traffic as it runs on single thread server but can be used to run on multi threaded server.
I want to use bottle.py for Enterprise web application with huge traffic.
Can anyone here let me know that there is no problem with bottle.py webapplication handling huge traffic.
Also it seems bottle.py version 1 hasn't been released yet.
I have no experience with bottle.py, but the first line of the FAQ says "Bottle is a micro framework designed for prototyping and building small web applications and services."
It sounds like the authors don't intend it to be used in the way you're suggesting.
I've done a lot of research for Google App engine. I ended up with webapp2. Now we realized that AWS has many advantages over GAE for our project.
I feel a little bit overwhelmed because there is so much information about AWS.
I ended up with the nosql dynamoDB solution.
Now I really love lightweight frameworks like webapp2 , its really simple and easy to use. It also don't hide post and get from you.
Now does it makes sense to use webapp2 for AWS ? Mabye there other frameworks that would fit better for our project.
(We want to go in a filehosting direction)
I mean there are literally 50 frameworks for python. And I didn't find a chart with pro/cons.
The last frameworks that I investigated are : web2py , pylon(now pyramids?) and tornado.
To be honest I am really confused.
So if I want to have a lightweight framework for AWS would you recommend me to stay with webapp2?
Resources:
Amazon AWS web framework for Python
Edit #1
Now it's a decision between tornado and webapp2. considering that I want to use dynamoDB.
Tornado is a fast non-blocking web server itself. It's easy to write simple apps in a few minutes, but it has nothing AFAIK like templates, views, etcetera. If you want to serve files it would be very quick to connect a tornado server together with boto (https://github.com/boto/boto) and use dynamoDB or S3.
On the other hand, pylons (now pyrmaid) and we2py are full web application frameworks with no web server. In fact, they come with a lightweight development server (at least pylons), but if you want to put up a site in AWS you should use something like nginx (http://nginx.org/), apache or some other wsgi server (http://wsgi.readthedocs.org/).
If you want to go for a lightweight framework and use python, I'd go for web2py, easy to configure and build apps. (A curious note: it used to be a single .py file) you can try it online: http://www.web2py.com/demo_admin/default/site
Regarding webapp2 I've never used it, but I've heard it's similar to Appengine web framework. So if you're comfortable with it stay there.
Either direction, boto is the python interface for AWS so if you choose python, you'll have to check it out. It is actively mantained.
I'm very interested in making real-time web apps with Django. Unfortunately, I'm having more than a little bit of problem with setting things up. Some options I'm considering:
Orbited: Seems to be the choice for Django. Unfortunately, their domains have seemingly expired, and with it pretty much all of the documentation I'd need to get it working. I've followed a tutorial on http://mischneider.net/?p=125 but I'm having a mysterious error (see No handlers could be found for logger "stomp.py").
Meteor: I have to say, their website impresses me. Unfortunately, I'm running Windows and there seems to be an abject lack of documentation for anything regarding Windows. So I'm lost.
Cometd: Similar problem: Just don't understand installation.
Tornado: Requires pycurl, which in turn requires curl. Keeps throwing a problem with CURL_DIR then libcurl.lib. After hours of tinkering, have effectively thrown up my hands in frustration.
Please help. I'm very willing at this point to consider, well, ANYTHING. Well, at least if it's documented to a point where I can figure out how to install it and use it with Django.
Any help appreciated.
To do real-time web apps using comet techniques (or websocket) you need a server that can handle long-lived connections and a javascript client. Most of the comet libraries give you both (APE, orbited, etc). Working with websockets seems preferable to me, it's part of HTML5, the client code is really simple to implement, etc. I'd suggest finding an asynch framework/server you like, and implementing the live/real-time part of your project with it.
Gevent has a long-polling asynch chat demo built on Django. Gevent is quite popular and well documented.
Eventlet is a nice concurrent networking library, it's pretty well documented.
Twisted is of course the de facto asynchronous networking library for Python. Here's an example of using websockets with twisted.
Meinheld is a nice lightweight asynchronous webserver, it uses greenlet and has examples of usage with Django, and with websockets.
Uwsgi has great asynchronous support, and tons and tons of features, several examples of various approaches. It has a fair bit of documentation as well.
Also check out the bottle documentation for a good primer on asynchronous applications.
Take a look at EvServer : EvServer documentation.
Could someone please explain to me how the current python webframworks fit together?
The three I've heard of are CherryPy, TurboGears and Pylons. However I'm confused because TurboGears seems to use CherryPy as the 'Controller' (although isn't CherryPy a framework in in it's own right?), and TurbGears 2 is going to be built on top of Pylons (which I thought did the same thing?).
There are more to it ofcourse.
Here's a comprehensive list and details!
Web Frameworks for Python
Extract from above link:
Popular Full-Stack Frameworks
A web application may use a
combination of a base HTTP application
server, a storage mechanism such as a
database, a template engine, a request
dispatcher, an authentication module
and an AJAX toolkit. These can be
individual components or be provided
together in a high-level framework.
These are the most popular high-level
frameworks. Many of them include
components listed on the WebComponents
page.
Django (1.0 Released 2008-09-03) a
high-level Python Web framework that
encourages rapid development and
clean, pragmatic design
Pylons (0.9.6.2 Released 2008-05-28) a
lightweight Web framework emphasizing
flexibility and rapid development. It
combines the very best ideas from the
worlds of Ruby, Python and Perl,
providing a structured but extremely
flexible Python Web framework. It's
also one of the first projects to
leverage the emerging WSGI standard,
which allows extensive re-use and
flexibility but only if you need it.
Out of the box, Pylons aims to make
Web development fast, flexible and
easy. Pylons is built on top of Paste
(see below).
TurboGears (1.0.4.4 Released
2008-03-07) the rapid Web development
megaframework you've been looking for.
Combines CherryPy, Kid, SQLObject and
MochiKit. After reviewing the website
check out: QuickStart Manual
web2py (currently version 1.43)
Everything in one package with no
dependencies. Development, deployment,
debugging, testing, database
administration and maintenance of
applications can be done via the
provided web interface. web2py has no
configuration files, requires no
installation, can run off a USB drive.
web2py uses Python for the Model, the
Views and the Controllers, has a
built-in ticketing system to manage
errors, an internationalization
engine, works with MySQL, PostgreSQL,
SQLite , Oracle, MSSQL and the Google
App Engine via an ORM abstraction
layer. web2py includes libraries to
handle HTML/XML, RSS, ATOM, CSV, RTF,
JSON, AJAX, XMLRPC, WIKI markup.
Production ready, capable of
upload/download of very large files,
and always backward compatible.
Grok (0.13 Released 2008-06-23) is
built on the existing Zope 3
libraries, but aims to provide an
easier learning curve and a more agile
development experience. It does this
by placing an emphasis on convention
over configuration and DRY (Don't
Repeat Yourself).
Zope (2.10.4 Released 2007-07-04,
3.3.1 Released 2007-01-14, Zope 3.4.0c1 Released 2008-01-31) Being the grandaddy of Python web frameworks,
Zope has grown into a family of
frameworks over the years. Zope 1 was
released in 1999. Zope 2 is both a web
framework and a general purpose
application server, today it is
primarily used by
ContentManagementSystems. Zope 3 is
both a standalone framework and a
collection of related libraries, which
are also included with newer releases
of Zope 2. All of the Zope frameworks
include the ZODB, an object database
for Python.
Give a try to web2py. It is point and click (you do not even need to install Python, comes with it). You develop using a web interface and you can deploy almost everywhere, including iPhone, Oracle and Google App Engine. Before trying web2py, try install some of the other Python frameworks, you will appreciate it even more.
CherryPy is not a full-stack web framework (like Django for example), in fact it isn't a web framework but a HTTP framework. Writing a web application using CherryPy is much like writing a regular object-oriented application in Python.
Also, CherryPy has it's own production-ready WSGI web server, which can be also used for applications written using other frameworks, hence the confusion surrounding CherryPy as a framework.
If you are looking for a start-to-finish solution then it's worth mentioning that the leader of the pack in that space is Django
Have you tried FastAPI.
It's a is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
Pretty easy to learn, quite powerful and lightweight.
https://fastapi.tiangolo.com/
I have been using for my application and it seems to be similar to Flask, but quite robust.
from fastapi import FastAPI
app = FastAPI()
#app.get("/")
def read_root():
return {"Hello": "World"}
Some Video Tutorials can be found here
You can also find a lot of help materials from here