Django alternatives for real time web applications [closed] - python

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've been developing a web server application with Django for the last year. The stack is Django + Apache + MySql. This stack was perfectly suited to our needs. Recently came the need of some real-time capabilities and the opportunity to change/rewrite a lot of stuff in the server application. To my surprise, Django is not the best option here.
I've been reading a lot (push, WebSockets, gunicorn... lots of stuff.. http://curella.org/blog/django-push-using-server-sent-events-and-websocket/) but I haven't managed to decide if I want to go with Django or if I should purpose a new stack of software which is more suitable for the job. Going with Django seems a little bit unnatural. Can any experienced developers point me in the right direction?
So, the basic question is: what are some alternatives to the current software stack I have for building a real time web application?
Thanks
PS: Not a native English speaker. :)
EDIT: The alternatives need to allow secure connections.
EDIT 2: The web applications we develop are games.

Look into http://www.tornadoweb.org/ + http://www.mongodb.org/ + https://github.com/bitly/asyncmongo + http://socket.io/
I think it's a good idea to use that to create real-time application.

You need to weigh your decisions against your goals.
You want a product
Then write your code in the language framework that you are most familiar with, only when you have a product and it has limitations consider switching tools.
You want to learn something new
Try out the new language, framework - but it may take a lot longer to produce a product and you may find that the new tool isn't any better than the old one.
Half and Half
Try starting two projects, and building the same thing in each project, just using the other tool. This will take even longer, but you should be able to see which tool you prefer / is best suited to your task very quickly.
Alternatives
I'm not quite sure what you mean by django is 'unnatural'. Django can do server / client communication - just use some AJAX to talk back to the django server, then call another pythonic library to process the request. Python alternatives to django include the wonderful flask and web.py, though neither will do client / server communication unless you program them too (like django). If you're not into python you might try ruby on rails. For the client side you will need to know something about JavaScript so go and learn up on that (coffescript and jQuery can ease JS pain, but do learn JavaScript first).
Of course you could bite the bullet and go with node.js as the server base, apparently it's pretty good (I've not tried it yet) - and written in JS.
EDIT:
In light of your comments, take a closer look at
django-websockets,
node.js + push server
websockets
Noting also that this question is a potential duplicate.

For the real time web applications I suggest that you go with the websockets, they can be secure and response times are very fast as when connection is made there are no overheads in communication anymore. If you are proficient in python you can make server in python twisted and clients in python and/or javascript using autobahn. P.S. here is a really great tutorial for twisted.

Related

Django: vibrant community and future? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I'm in that horrible questioning state. I'm trying to decide between Django and Rails.
From what I've read, Django probably fits my needs better, both from a "cultural" and goal point of view. The baked-in admin interface pretty much sells me alone. However, I have one critical concern: it looks like the Rails community is much larger. This could be a plus OR a minus; read on.
I have experience hanging my hat on a technology that does not have as vibrant a commmunity as its "competitor." I run a Mac consulting firm in the Bay Area. Up until very, very recently (like the last year!), finding resources for very difficult issues (especially server- and network-related) was so difficult that it was often not even worth trying. This is now changing rapidly due to the Halo Effect, but if it wasn't for Steve Jobs' return to Apple and the iPhone, the future would look just as bleak as the past.
So, while Django looks awesome, I am concerned about pigeonholing myself in yet another niche. I'm less concerned with my theoretical job prospects as a Django developer (I like my job) than I am with simply having resources available to create and maintain cutting-edge projects that can evolve with the Web, and not lag too far behind.
From the above point of view, it looks like Rails has the advantage. However, here's a problem I've noticed that seems to come from the vibrancy of the Rails community: Want to accomplish a particular Rails programming task you've never done before? Google it; you'll find three to six+ different plugins, each with as many advocates as detractors. How do you decide which to use without spending hours and hours learning and prototyping? How do you know that the one you choose won't be end-of-lifed in 12 months, and you'll have to redo that part of your app in order to stay current with the latest Rails distribution?
My latter point brings me right back to where I started: Django seems like a time-saver. Except now I have two reasons to think so, not just one.
I should mention that I've already spent a significant amount of time learning Ruby and Rails, dabbled a bit in Python, and quite prefer Ruby.
Would love your thoughts.
If the size and the vibrancy of the community is the main problem, than maybe you should look at other framework stacks not just Django and Rails (those two make allot of noise and hype, but there are other much more bigger that don't get that loud - e.g. Java/JVM based framework stacks have users in a few order of magnitude higher than those two you mention).
If the game however is just between these two, when I would decide, I would take in consideration especially the available tools (how good the IDE support is) - at least for me they're very very important, since they're what make a productivity difference.
Even if on the Mac the hype is of course TextMate, with all the respect, that is just an advanced editor - not an IDE with "smart" features like error highlighting in code, smart and correct completion, etc.
The smartest existing IDE for Rails is RubyMine, so considering that for Python (Django) there's nothing not even close that advanced, I would choose Ruby on Rails even for this just only reason. Of course, another plus point for RoR is the bigger number of books available (so when in doubt, I have better chances to find a solution in one of them).
What about Pylons?
From what I have seen neither one looks like it will become a niche any time soon, both have active communities and dedicated developers. Ruby and python are both great languages, and both are being actively developed as well. At some point Django will have to migrate from python 2.x to 3.y, which may be a little bit painful, but the same sort of thing can be expected from rails at some point in the future.
I think you have narrowed it down to the right two for being main stream yet not stagnant. They both have advantages and disadvantages, and if there isn't a clear reason to chose one or the other for your project, I would say go with the language you prefer. Python is my language of choice, so baring some killer reason to chose RoR, Django is the natural way to go to continue developing the way I like to. If you prefer ruby, I would recommend going with RoR unless Django seems to fit your application in a way RoR does not.

Python vs all the major professional languages [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I've been reading up a lot lately on comparisons between Python and a bunch of the more traditional professional languages - C, C++, Java, etc, mainly trying to find out if its as good as those would be for my own purposes. I can't get this thought out of my head that it isn't good for 'real' programming tasks beyond automation and macros.
Anyway, the general idea I got from about two hundred forum threads and blog posts is that for general, non-professional-level progs, scripts, and apps, and as long as it's a single programmer (you) writing it, a given program can be written quicker and more efficiently with Python than it could be with pretty much any other language. But once its big enough to require multiple programmers or more complex than a regular person (read: non-professional) would have any business making, it pretty much becomes instantly inferior to a million other languages.
Is this idea more or less accurate?
(I'm learning Python for my first language and want to be able to make any small app that I want, but I plan on learning C eventually too, because I want to get into driver writing eventually. So I've been trying to research each ones strengths and weaknesses as much as I can.)
Anyway, thanks for any input
An open source project I work on for VCS integration (RabbitVCS) is written entirely in Python/PyGTK and includes:
Two file browser extensions
A text editor extension
A backend VCS status cache running asynchronously, using DBUS for the interface
A fairly comprehensive set of dialogs, including VCS log browsers, a repository browser and a merge wizard (maybe that one isn't such a selling point).
There's no standalone app, but we're thinking about it.
Because we're always adding new features, and currently trying to adapt to new VCS', Python is ideal for the ability to quickly refactor entire layers of code without breaking our mental flow. I've also found that the syntax itself makes a real difference with complicated merging of version controlled branches, but that might come with the ability to read it quickly.
Recently we've begun adding support for a new VCS, requiring:
refactoring current code to separate VCS specific actions and information from common/generic information
refactoring the UI layer to accomodate the new functionality
Most of what we've achieved has been possible because of the availability of C/Python bindings (eg. PySVN, Nautilus-Python, etc). But when it hasn't been available... well, it's not that hard to roll your own (as a developer did for the new VCS). When the bindings lack functionality... it's not that hard to add it.
The real drawbacks so far have been:
Threading mishaps. Lesson learnt: forget about threads, use multiple processes where possible or your toolkit's threading method (eg. PyGTK, wxPython and Twisted all have their own ways of dealing with concurrency)
(C) Extensions. Cause threading mishaps (they almost invariably lock the GIL, preventing threading). See above.
Needing to hack on C bindings when certain functionality is unavailable.
Profiling can be tricky when you're not just doing something based on a single function call.
If you want to know about more specific aspects, ask away in the comments :)

CherryPy vs Django [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
CherryPy vs Django, which would you use and why?
They're not exactly comparable. CherryPy provides url routing and a request/response abstraction, which makes prototyping very easy (although I find vanilla mod_python just as convenient). Django is a complete web application "stack", including a templating system and an object-relational mapper.
Django is vast, and difficult to learn, functions, tags and what not, you will absolutely are a computational genius if you have figured Django out completely. "full-stack" means every thing is available, you just have to spend the time looking for it :(
CherryPy is light and clean and far less complex. Compare the starter tutorials 1pg vs 4pgs you know what I mean. Its the difference between the "full-stack" java and the light and easy perl.
PS: the Django admin interface ROCKS!!
Though e.e. coli has already provided the accepted answer (and a good one at that), one thing I'll say in favor of CherryPy is that it is also implements WSGI out of the box. What this means is that, unlike the mod_python approach mentioned (which I believe is still an Apache-only solution)*, it provides abstraction from your web server. If you are all Apache all the time, this isn't so much a win, but if you ever think you may want to try alternate web servers, such as Lighttpd, then you can swap your web server w/o also having to make adjustments in your Python app. This was a big win for me personally.
*I don't mention Django here because I'm not a Django user (I don't like "full stack" frameworks) and so will leave any comments regarding it to it's many fans - all of whom are more qualified than I to answer questions about it.
Django, because the community is so much larger. You'll find more 3rd-party modules you can use and you'll find much more support.
I would use Django because of its large user base and existing modules (including the built-in admin interface) but I would imaging that CherryPy is more flexible than Django. You just have to look at the available options, figure out what you want to do and choose the platform that supports that the best.
CherryPy is web server "http framework", while Django supports web application front-to-end: it provides object-relational mapper, template, session management, automagically generates DB schema and all CRUD screens, and more.
I think they're both great, but I'm not a fan of full stack frameworks. CherryPy is a lot easier to use and much more flexible.

What's a good medium/large project for a Python programmer? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Just like the title asks. I've been learning Python for a while now and I'd say I'm pretty decent with it. I'm looking for a medium or large project to keep me busy for quite a while. Your suggestions are greatly appreciated.
Find a local charitable orgainzation with a lousy web presence. Solve their problem. Help other people. Learn more Python. Everyone wins.
You can invent a game and code it with pygame. They're always fun to code and you still learn a lot when you code a game.
What are you interested in doing? You could write a whole host of database programs, for keeping track of recipes, cd's, contacts, self tests, etc....
Basically make code to load/save to a database and enforce some business rules, then expose it by a web service. Then make both a web front end and an application graphical front end (using TK/WxWidgets/Qt (4.5 will be LGPL YAY)) that talk with the web service.
That should give you practice with creating/talking with web services (something more and more companies are doing) along with both main ways of creating a GUI.
You could try to replicate an application that is impressive to you just for the sake of guessing how it works behind the scene.
If I had to do that, I'd probably try to clone the following webapps using Django:
BaseCamp
dPaste
Reddit
Mint.com
Here at stackoverflow there are already people asking for solutions to their problems:
e.g.: If you are interested in GUI programming: thumbnailctrl
Anything that hasn't been done to death... no need for yet another clone of popular app x
What I like to do is(with my ti 83) instead of doing all my math by hand I like to program my calculator ti di the problem then do the rest of the problems with the new program. It's fun and you get your homework done so you could do this in python for a fun project(s).
Consider something that does the following:
is multi threaded and preferably include need for synchronization
reads/writes data to a remote database (or even local database)
reads from a web service and includes xml parsing
outputs xml/ html
There are a number of example projects you could do, but if you accomplish all the above, then it will surely give sufficient exposure.
If I had the time to code something just for the fun and the experience, I would personally start an open source project for something that people need and which does not already exist.
You can search the Web for a list of missing opensource projects, or you can base it on your own experience (for example, I would personally love to have some way to synchronize my iPhone with thunderbird+lightning : I hear there's a solution through Google Calendars, but I would like a solution without external servers).
I think the best thing you can do now is spend time learning a new technology, preferably including a new programming language.

Recommended Python publish/subscribe/dispatch module? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
From PyPubSub:
Pypubsub provides a simple way for
your Python application to decouple
its components: parts of your
application can publish messages (with
or without data) and other parts can
subscribe/receive them. This allows
message "senders" and message
"listeners" to be unaware of each
other:
one doesn't need to import the other
a sender doesn't need to know
"who" gets the messages,
what the listeners will do with the data,
or even if any listener will get the message data.
similarly, listeners don't need to worry about where messages come from.
This is a great tool for implementing
a Model-View-Controller architecture
or any similar architecture that
promotes decoupling of its components.
There seem to be quite a few Python modules for publishing/subscribing floating around the web, from PyPubSub, to PyDispatcher to simple "home-cooked" classes.
Are there specific advantages and disadvantages when comparing different different modules? Which sets of modules have been benchmarked and compared?
Thanks in advance
PyDispatcher is used heavily in Django and it's working perfectly for me (and for whole Django community, I guess).
As I remember, there are some performance issues:
Arguments checking made by PyDispatcher is slow.
Unused connections have unnecessary overhead.
AFAIK it's very unlikely you will run into this issues in a small-to-medium sized application. So these issues may not concern you. If you think you need every pound of performance (premature optimization is the root of all evil!), you can look at modifications done to PyDispatcher in Django.
Hope this helps.
The best dispatch package for python seems to be the dispatch module inside django (called signals in the documentation). It is independent of the rest of django, and is short, documented, tested and very well written.
Edit: I forked this project into an independent signal project for Python.
Here is a newer one: https://github.com/shaunduncan/smokesignal. "smokesignal is a simple python library for sending and receiving signals. It draws some inspiration from the django signal framework but is meant as a general purpose variant." Example:
from time import sleep
import smokesignal
#smokesignal.on('debug')
def verbose(val):
print "#", val
def main():
for i in range(100):
if i and i%10==0:
smokesignal.emit('debug', i)
sleep(.1)
main()
I recently looked carefully at py-amqplib to act as an AMQP client to a RabbitMQ broker. The latter tool is written in Erlang.
If you're looking to decouple your app. then why couple it to the language itself? Consider using message queues which are language neutral and then you've really got room to grow!
That being said, AMQP takes effort to understand and may be more than you are willing to take on if your app. is working just fine as is. YMMV.
Some libraries I have found that haven't yet been mentioned:
Circuits - a Lightweight, Event driven Framework with a strong Component Architecture.
C# Event Recipe
There is also the libraries by PJ Eby, RuleDispatch and the PEAK project, specially Trellis. I don't know what their status actually but the mailing list is quite active.
Last version of Trellis on PyPi
Trellis doc
I have also used the components from the Kamaelia project of the BBC. Axon is an interesting approach, but more component than publisher-consumer inspired. Well, its website is somewhat not up-to-date at all... There was a project or 2 in the Google SoC 2008 and work is being done.
Don't know if it help :)
Edit : I just found Py-notify which is an "unorthodox" implementation of the Observer pattern. It has most of the functionalities that I need for my own tools.
The fact alone that PyPubSub seems to be a somewhat chaotically managed project (the Wiki on SF is dead, the website (another Wiki) which is linked on SF is currently broken) would be enough reason for me not to use it.
PyDispatcher has an intact website, but the only documentation they seem to provide is the one for the API generated from the docstrings. No traffic on the mailing list either... a bad sign!
As Mike also mentioned, it's perfectly possible to choose a solution that is independent of Python. Now don't get me wrong, I love Python, but still, in this field it can make sense use a framework that is decoupled from the programming language.
I'm not experienced with messaging, but I'm planning to have a look into a few solutions. So far these two (free, open source) projects seem to be the most promising for me (coincidentally, both are Apache projects):
ActiveMQ
Qpid
Both seem to be reasonably matured projects, at least a far as documentation and community. I can't comment on the software's quality though, as I said, I didn't use any of the software.
Qpid ships with client libraries for Python, but you could also use py-amqplib. For ActiveMQ there's pyactivemq, which you can use to connect either via STOMP (Streaming Text Orientated Messaging Protocol) or via Openwire.

Categories

Resources