Being a web developer (php, symfony, doctrine) for 2 years now, I was recently asked by a friend to come up with a desktop solution. So I developed a project, installed a LAMP on his machine and he is mostly happy using it now. But I'm not. It just doesn't seem right to wait for a server response from a localhost. Obviously php isn't suited for desktop development. So, my question is: what language \ framework would you advice a php programmer if he was going to develop a desktop application (something that you can install, that has it's own gui, but utilizes the similar concepts of web apps: css, javascript, orm).
I would like to bring up Python as a possible answer to my question. Does anyone have an experience of developing a desktop app with Python, utilizing an ORM and(or) HTML-based GUI?
You should definitely use Python. It's great and really easy to get up and running and extremely powerful.
utilizing an ORM and(or) HTML-based GUI
Please don't do this. HTML has its purposes, and it's not in desktop apps. Please don't force your experience into new technologies.
You should look at the various python GUI frameworks. Tkinter, PyQt ( my preference), or GTK
It just doesn't seem right to wait for a server response from a localhost
Exactly! Did you profile your app, both on server side and in browser? There's no reason for a local web app to be slow, except if it is designed or implemented suboptimally. Same applies to a desktop app, which is generally harder to create.
So, fire up your Firebug, do explain plan to every database query your app issues, add whatever profiling your PHP settings allow, and see where the problem lies. Most probably, it's not in the choice of language.
Maybe Adobe AIR is something to take a look at? Check out their sample applications. If you don't like using a "proprietary" technology, check out HTML5 technologies like Web Storage and Web SQL (not in the HTML5) spec.) These technologies are completely client side (but can be extended to work over a network), so no need to wait for a server.
I've no clue how capable/easy to work with the Web SQL route is, but there are some decent AIR applications out there.
I've recently come across a project called Titanium. It's a platform for developing native desktop (and mobile) applications using web technology (html/css, javascript and server-side languages like python, ruby and PHP! That's exactly what I was looking for. However, I haven't found no decent documentation or examples, community is small, so it seems to be underdeveloped right now. It mostly aims at mobile development rather that desktop.
Apart from Titanium, I currently don't see a better way for a web developer to go.
Is the target platform windows? If so, consider C# with WPF. The UI is constructed using XAML which is very similar to HTML/CSS. C# uses the .NET framework, so while it is a much different programming language than PHP, the transition should not be too difficult.
Related
I have a couple of Python 2.7 scripts I need to have them run from a webpage. I've never done this before, although I'm comfortable coding in Python and well versed in Linux, Apache, Nginx.
I see many different frameworks like the old CGI, WSGI, Django, etc.
I need some recommendations for a framework that would require not much changes on my Python code for it to run on a webpage.
It seems CGI would be fairly easy for me, but since there are many newer frameworks, I need some advices.
Thanks!
Flask is probably the most straightforward Python web framework to use. It touts itself as a micro framework, and is very, very fast to get up and running with.
If you have a relatively straightforward set of requirements, I'd highly recommend giving it a look over. You can find the "hello" world example on the project's homepage here: http://flask.pocoo.org/
Depending on your project's requirements (does it need to be highly available/resilient?), you may even be able to get by using Flask's built-in development webserver along with a process control system such as supervisord. I wouldn't recommend this for heavy or production workloads, but for something running out of production this set up would work just fine for you.
If you're looking for client side browser frameworks in Python, there are skulpt and brython.
When I was looking for a similar framework, I decided to learn leave python for a javascript framework (particularly AngularJS and Node JS) for a client side language. I personally felt that the size of community and learning resources available in those two areas were more robust, and provided greater opportunity to master the framework.
I am wondering how to go about implementing a web application with Python.
For example, the html pages would link to python code that would give it increased functionality and allow it to write to a database.
Kind of like how Reddit does it.
If you're looking for server side programming with databases and html templates etc, I think Django is great, along with Pyramid. However, I use Flask ( http://flask.pocoo.org/ ) for this since it is easy to use, learn and deploy even though it may not have as much support as the before mentioned 2 framework since it's just a microframework, using the Jinja2 templating engine, including a development test server with it's own debugger.
On the other hand, if you're going for client-side programming (i.e. in browser implementation ) You can look up .NET Ironpython or even Brython which uses python like javascript.
You might want to check out mod_wsgi or mod_python.
What Is mod_wsgi?
The aim of mod_wsgi is to implement a simple to use
Apache module which can host any Python application which supports the
Python WSGI interface. The module would be suitable for use in hosting
high performance production web sites, as well as your average self
managed personal sites running on web hosting services.
-
Current State of Mod_Python
Currently mod_python is not under active development. This does not
mean that it is "dead" as some people have claimed. It smiply means
that the code and the project are mature enough when very little is
required to maintain it.
This is a good article from the Python website:
http://docs.python.org/howto/webservers.html
Plain CGI is a good starting point to learn about server side scripting, but it is an outdated technology and gets difficult to maintain after certain level of complexity. I would think it is no longer used in industrial-grade web server anymore. Plus you have to setup a web server and then install some module to interpret python script (like Apache with mod_python) just to get started.
I had some experience with Django (https://www.djangoproject.com/) and found it fairly easy to get started with since they come with development test server. All you need to have is a Python interpreter + Django and you can get up-and-running quickly and worry about the deployment setup later. They have pretty good documentation for beginner as well.
We have never used Python for a web site without a framework. In our case that is Django. In other words, we do not use Python for our web sites the way Perl can be used, just having Apache run a Perl script.
The recommendations you have received about Django are sound. If you go the Django route, Graham Dumpleton and the modwsgi Google group were very helpful to me. I could
not have gotten mod_wsgi deployed on Red Hat Enterprise 5 64-bit without Graham's help.
Whether you choose Django or "straight" Python, you will need to become familiar with mod_wsgi.
Good luck in quantum time, which means by now, I hope this all worked out for you.
I will soon start a new project with Amazon Web Services, on Linux
They have frameworks available for PHP, Ruby, Python, Java and .Net
http://aws.amazon.com/ruby/
http://aws.amazon.com/python/
I am fluent in PHP and Java, I hate .Net
The project is to have a lot (around 50) Amazon instances connect to a central pile (or decentralized, not sure yet) to have jobs to do, with auto-scaling and such.
This implies there will be a lot of database and communication between the instances.
Also, a lot of the job will be Web related like using another Web service, crawling a website, etc. So I need good JSON/XML support and stuff like SOAP would be nice.
I did all that in PHP once using SQLite and going through Apache, but since we are moving to Amazon, we now have granular control of each node with the command-line and everything, I feel it would be way better with a PostgreSQL database and daemons in Ruby/Python.
What do you think?
MySQL or PostgreSQL?
Rewrite everything that was done in PHP to make better daemons in Ruby or Python?
If not, I will simply convert a lot of the code to use the CLI instead of going through Apache.
I am very open to other suggestions
Thank you a lot
If you have no pressing need for a rewrite, just use your existing codebase. Maybe refactor some things step by step, to see if Ruby, Python or Java suit well for particular problems. Python for example is a perfect glue language, also good for crawling and has native json support since 2.6.
I need to develop a web application with the following requirements:
Desktop like UI on the client side
Application deployment
Scalability (i.e. distributing the service on multiple servers)
What I thought of so far (as I love Python but haven't done much web development yet):
Django
Fabric (think I've read somewhere it's suited for this)
What I'm missing is:
How to create rich clients (probably need some javascript libraries for that)?
How to distribute the service?
For RIA you need to use some client technology in your templates.
See at Dojo or ExtJs.
ExtJs docs have example of Web Desktop app, but this library is not free for commercial project. I like more Dojo, and it is free.
Rich Internet Application: Javascript to do stuff asynchronously (AJAX). If you want a desktop-like interface on the web, it seems currently CoffeeScript is the way to go. It's a language that compiles into Javascript and adapted for rich interfaces.
Deployment: fabric (I think it's used to deploy Python apps).
Distribution: you deploy the code to one server.If you need to scale it up, you just need some additional servers (of course if you have specific usages like very high load on a database, you'll also need to add more database servers etc. But you get the idea).
using web browser as your client platform?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last month.
Improve this question
I have been experimenting with Appcelerator Titanum yesterday and I think it's cool when it comes to Javascript.
Python features on Appcelerator Titanum are so limited (can't use some modules for example).
My question is How can I use html & javascript as a GUI tool for a real python application ?
I am running windows 7 and i was thinking of using webkit for that purpose but couldn't know how to work with it in python.
I am planning to make a standalone executable using py2exe as I don't know if the users always have python and the appropriate modules installed.
If you're after webkit bindings for Python, look at PyQt, which includes Webkit, as well as wxWebkit (http://wxwebkit.wxcommunity.com/) if you're using wxWidgets. This lets you embed webkit in a Qt or Wxwidgets app so that you won't have to go through a browser.
If you do use this, then you can either use a web server in Python, like others have mentioned, or you can control the Webkit control directly (though I'm not sure how practical this is).
Beyond that, there's also Pyjamas Desktop (http://pyjs.org/), which lets you use Pyjamas to build the application, then run it.
pywebkitgtk might be what you are looking for.
"HOWTO Create Python GUIs using HTML" http://www.aclevername.com/articles/python-webgui/
http://arstechnica.com/open-source/guides/2009/07/how-to-build-a-desktop-wysiwyg-editor-with-webkit-and-html-5.ars
But I'm not sure if it runs on Windows.
PyQt and Webkit would work on Windows.
http://www.rkblog.rk.edu.pl/w/p/webkit-pyqt-rendering-web-pages/
Here is a nice PyCon talk on the subject.
So how can I use html & javascript as a gui tool for a real python application ?
You run a web server on your desktop. For example, this: http://docs.python.org/library/simplehttpserver.html In a few lines of code you can provide a complete HTTP server that will serve your HTML and Javascript to a browser.
I am running windows 7 and i was thinking of using webkit for that purpose but couldn't know how to work with it in python actually moreover I wanna use py2exe so how can I use python + webkit to handle the gui part ?
Hard to parse that. It either indicates too much coffee or no familiarity with punctuation.
Randomly, I'll pick the following words as possibly being meaningful.
how can I use python + webkit to handle the gui part ?
You run a web server on your desktop. The web server provides html and javascript pages to a browser -- also running on your desktop.
Have you looked at htmlayout? http://terrainformatica.com/htmlayout/main.whtm
PHP Desktop is an open source project founded by Czarek Tomczak in
2012 to provide a way for developing native desktop GUI applications
using web technologies such as PHP, HTML5, JavaScript & SQLite. The
development workflow you are used to while creating web applications
remains the same. The step of turning an existing website into a
desktop application is basically a matter of copying it to the "www/"
directory.
PHP Desktop also releases Python Desktop and Ruby Desktop. It allows you to create a Windows app, that either uses the installed IE for the front-end, or uses an instance of Chrome (so definitely HTML5 support too) that is packaged with the app. It starts a local webserver, supports many databases with a PDO driver and you can layout the views in HTML and Javascript. You can download external resources like any other website/webapp, so it supports network related stuff too. The app ships with its own bare-bones version of Python, you can add libraries as desired.
I looked at all the answers before, as I had the exact same question as you, but PHP Desktop easily solved it for me.
https://code.google.com/p/phpdesktop/wiki/EmbeddingOtherScriptingLanguages
I assume you are mobilizing a web-application for cross platform access.
If so have you considered abstracting the cross platform access at the web-app presentation layer ?
Appcelerator / Webkit does not provide true native look-and-feel on mobile devices but this is where a new technology can help.
If you are thinking about real desktop applications that are multi-threaded and/or use multiple system component - forget about JavaScript. That requires a very good SDK (like PyQt4), and not a basic wrapper like Appcelerator Titanium. Note that developing such applications takes a lot of time.
Second option is to drop the desktop binding and make a web application with an advanced frontend UI made with one of JavaScript frameworks & friends (Ember, Angular... up to things like dhtmlx and alike widgets). Those can't use system components (like access some hardware), but they can provide nice services.
Take a look at pySide
I suggest using QtWebKit
And you can use PyInstaller if you want to hide the source code.
You can use TideSDK that can help you creating beautiful and unique desktop apps using your web development skills (HTML5 / CSS3 / JavaScript / Python or PHP or Ruby).
Website: http://www.tidesdk.org
Using Python in TideSDK: http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/using_python
Hope that helps! :)