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.
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 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.
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.
What is the best way to communicate between a Python 3.x and a Python 2.x program?
We're writing a web app whose front end servers will be written in Python 3 (CherryPy + uWSGI) primarily because it is unicode heavy app and Python 3.x has a cleaner support for unicode.
But we need to use systems like Redis and Boto (AWS client) which don't yet have Python 3 support.
Hence we need to create a system in which we can communicate between Python 3.x and 2.x programs.
What do you think is the best way to do this?
The best way? Write everything in Python 2.x. It's a simple question: can I do everything in Python 2.x? Yes! Can I do everything in Python 3.x? No. What's your problem then?
But if you really, really have to use two different Python versions ( why not two different languages for example? ) then you will probably have to create two different servers ( which will be clients at the same time ) which will communicate via TCP/UDP or whatever protocol you want. This might actually be quite handy if you think about scaling the application in the future. Although let me warn you: it won't be easy at all.
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 11 years ago.
I am still kind of new to programming and after playing around with a lot of languages trying to find which one worked best for me I stumbled across python and have been doing really well with it.
The only problem/concern I have is that I do not mainly want to do web development. I want to create desktop apps with nice GUis as well. Unlike most other programming languages that I have dabbled in python doesn't seem to have one definitive ide for this sort of thing which kind of sucks imo, especially since it's such a cool language.
I've searched and found quite a few IDEs that include GUI designers with code editing as well but I can't decide which one to use. Of those I am interested in the following
BlackAdder - http://www.thekompany.com/products/blackadder/
Pythoncard - http://pythoncard.sourceforge.net/
Boa Constructor - http://boa-constructor.sourceforge.net/
SPE - http://pythonide.blogspot.com/
Dabo (is it even an ide?) - http://dabodev.com/
Eric IDE - http://eric-ide.python-projects.org/index.html
Xrope - http://xrope.sourceforge.net/
I am not looking for opinions on which one is the "best" or anyone's favorite. I want to know which one is the most widely used and which one I would be able to find the most documentation on and get the most user support from whether it be via forums, here, community, etc..
P.S. If anyone cares to post any links to some documentation/tutorials with their answer it would be greatly appreciated.
P.P.S. Does anyone know if there are any plans for a larger company maybe thinking of creating a full fledged ide comparable to Delphi, Visual Studio for python in the foreseeable future? Would make things a lot easier IMO.
Thanks..
You can use Visual Studio to build IronPython GUI applications as well: http://msdn.microsoft.com/en-us/library/bb165375(v=vs.80).aspx
EDIT: You can now use pytools (http://pytools.codeplex.com/) to develop non-IronPython apps in VisualStudio.
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 am evaluating options for a scripting language to embed at my company.
We mostly make indie games, and we use managed frameworks (Unity and XNA). This means that we need a solution that works with both Mono and .Net, and we'd rather avoid stuff that is too slow.
The possibilities we are considering are the following:
python
lua
F#
The features we require are:
continuations/coroutines
decent performance
integration with Mono and .Net (compatible type systems)
[optional]. ease of extensibility to add new combinators such as multithreaded coroutines
[optional]. easy bindings
I know for certain that I can achieve all requirements in F# with a custom-built monad (I have several working prototypes which are ending in a few products) but I would gladly jump to another solution if it is proven to be better!
As you're using .net anyway, any of the .net languages might allow you the easiest implementations. From a learning perspective etc. I'd prefer Lua any time due to it's rather simple basic constructs and syntax rules.
I have a weird-er suggestion for you. How about using C# or VB.NET?
You can dynamically compile scripts and save the assemblies. This way you get minimum loading time.
You can also register them in the GAC and have no worry!