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 9 years ago.
I'm looking for a way to make two Python scripts communicate over the internet. Something like what Socket.IO does with NodeJS, but without a browser, and in Python.
A constant connection (socket?) would be the best in my option, but if this is impossible or really difficult, using normal HTTP requests could be fine too.
Are there any frameworks to do this? If yes, which ones? Is there proper documentation? If no, how would this be achievable without a framework?
sockets are indeed what you're looking for. The Python docs have pretty good examples at the bottom of the page I linked.
As for frameworks, there is twisted which might help streamline the socket construction and message handling for you.
Lastly, there is an extremely helpful guide I reference often when programming with sockets. Warning: The guide is written for C, but the concepts apply nonetheless.
You should try to do this with xmlrpclib : http://docs.python.org/2/library/xmlrpclib.html.
It handle HTTP request.
Related
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 11 years ago.
i use python+django for my web projects and i love it for code readability and speed development. But now i want something very fast, low cost for resources and simple (minimalism) but in the same time code-readable as django.
Which DB backend to use?
Simple and fast ORM in django style?
Fast template system (with inheritanse)?
Web server written in python (i look at tornado or pyev for async server)?
cache system?
what do you recommend in this case?
Django will suit your purposes. (Unless you're doing high-frequency trading on the stock exchange).
I'd recommend looking into Flask (http://flask.pocoo.org/):
Take your pick
SqlAlchemy
Jinja2
http://flask.pocoo.org/docs/deploying/ and http://flask.pocoo.org/docs/deploying/others/
Not sure
I personally tend to like Tornado a lot lately indeed.
Now, the question is: what are you looking for in a web framework? Fast development? Fast performance? Simple API? Active open source community?
Do you need a full stack framework like django or maybe you are good enough with a simpler environment? Will you serve dynamic pages or expose a REST api? If you are in the latter case, Django would not be my first choice, there are easier things to look at (I love web.py, FWIW).
Tornado sounds like a good choice if you are looking at async code too, anyway it's hard to give an answer without knowing more about your requirements.
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 want to learn server-side scripting. Since I know some Python, probably that would be the best to start with (tell me if I am wrong). The problem is that I do not know even the basics of server side scripting. Is there a good book or tutorial that can help me get started?
I know there are many web frameworks in python - flask, bottle, django, cherrypy etc. But before I start reading the manual of one of these, are there other basics to learn.
I know basic HTML, CSS and I am currently learning basic Javascript.
Thank you.
I found some good references on Python Web Programming page that I had not seen earlier. You can see them if you scroll down to Books and Articles section on http://wiki.python.org/moin/WebFrameworks page. As stated there, Lutz's Programming Python contains a lot of information on internet programming. You will see some other references there, such as Wesley Chun's book, which gives a very good explanation of client and server concepts.
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 11 years ago.
I need to create 2 level web-system. I choose Python as my tool.
I want use PyQt to develop 1st level: TCP/IP-server, and Django as 2nd level: Data visualization through Ajax(Front-End). System sketch on picture:
http://i.stack.imgur.com/pprv9.jpg
1st level will "chat" with about 1000 objects. And web-app with about 200 people.
Is it right way to use Python, Django and PyQt? Or may be there is better architecture solution?
While PyQt's networking module provides tools for writing TCP servers, I'm not sure you really need that dependency, since TCP servers can be written just in Python using only the standard library, and in fact Python already comes with a simple HTTP server built-in (and so does Django, by the way).
I have nothing against PyQt (quite the contrary, I like it a lot), but mixing its programming model and idioms into a Python program has to be done for a reason, and a network server isn't IMHO a good enough reason. If you want a GUI, then sure. But for a network server, just stick with Python, which has some incredibly powerful libraries of its own for writing servers, the foremost being Twisted, which you should definitely check out.
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.
Perl has the strict and warnings pragmas and a couple of CPAN modules for encouraging good style and reducing errors. Is there a Python counterpart that can help me avoid such problems and bad practices while it encourages me to use a more Pythonic structure?
I should make it clear that I do not know what I want to avoid. There is probably a lot of traps to fall into, and I'm not looking for a substitute to reading good code, reading about common errors and writing a lot, but for a complementing automated resource.
I believe pylint (http://www.logilab.org/857) is the most most common tool used for this purpose.
The classic style guide for Python is PEP8. If you are interested in style errors, a checker for PEP8 can be found at http://pypi.python.org/pypi/pep8.
googling for Python lint yielded this: http://pychecker.sourceforge.net/
Don't forget the -t option to the python interpreter for tab warnings and if you're currently using 2.x and want to minimize the trauma of switching to 3.x in the future, the -3 option will help.
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.
Do you know of well designed open source applications that are instructive to analyse?
Of course this question is strictly related to this other post, but I am specifically interested in applications written in Python.
Django is a python package that is very nicely coded and designed.
Look in the Python Standard Library. It is a great wealth of python code. I particularly like this.py :)
Seriously though there is good code in the std library.
Zope .
Pyramid is Great !
Pyramid - Web Framework