supercheetah
supercheetah

Reputation: 3250

A good Python web framework for existing console program?

I hope I'm asking on the right StackExchange site.

I've written a console program in Python onto which I'd like to put a web interface, but I'm having a hard time deciding what web framework to choose. I don't need much, but I'd like to avoid unnecessary work in trying to use it. I don't have a need for a database (for now), so that's not important to me at all.

I've looked at Django, Web2py, bottle.py, and web.py.

Django and Web2py seem to be great if I were starting out from scratch, but I'm not, and seems a little difficult to integrate into existing code.

bottle.py and web.py almost seem like they could work out, but they're so basic, I'm hoping there's something else out there that wouldn't require so much in the way of templating as these seem to do.

I don't simply want to make a carbon copy of the console interface put into a browser, but rather customize it for a web interface, so I'm not necessarily looking for anything that would simply wrap a console application into a web interface (although that would be interesting too.)

Upvotes: 2

Views: 2160

Answers (4)

Sylvain Prat
Sylvain Prat

Reputation: 301

Thanks the continuation which is implemented in the Nagare framework, you can develop a Web application like a console or desktop UI application: put the console code in a component.Task, then create some components for each interaction, i.e. some views that show the data that you print in your console application and receive some user input back. Then, the Nagare framework takes care of the rest: no need to declare URLS, to pass the context from a page to next...

Upvotes: 2

Kirill
Kirill

Reputation: 3454

I suggest Django. I've used Django both for simple mostly static sites and for sites with a lot of forms and I can't say Django imposes any restrictions or forces you to write hundreds LoC even for simple things. Instead you get nice auto generated administrative interface, built-in ORM, internationalization tools and many other things. Thereby, you have great opportunities to grow functionality of your app. In addition it has such vital thing as up-to-date documentation for every module.

Tutorial takes few hours and gives enough information to start developing full-blown sites.

Upvotes: 2

tara
tara

Reputation: 46

That's a sort of hard problem... Personally I don't see web.py as all that 'basic' as you put it. It should be really easy to wrap your code in some classes with GET and POST functions and be done.

Also, Django can be 'minified' as it were: How do I write a single-file Django application? is a whole conversation about this.

I would say, what is too 'basic' for you? You mentioned 'templating', but how would something magically template for you? There are open source templates for web apps, things like twitter bootstrap come to mind, that kind of give you a ready-made template for your next web app. Also YUI, and dojo do similar sorts of things (tho have a much different focus, since they are full blown JS frameworks).

That said, there is a brand new project called 'shovel' (here): https://github.com/seomoz/shovel

I haven't used it yet, but it seems to do the wrapping of commands into a web interface for you. which you said would be 'interesting'.

Personally I use web.py for all my web stuff.

Upvotes: 3

user1259765
user1259765

Reputation: 33

PyQT can be handy if you are looking to implement it, to quote from the RiverBank PyQT website listed below:

"The QtWebKit module implements a web browser engine based on the WebKit open source browser engine used by Apple's Safari. It allows the methods and properties of Python objects to be published and appear as JavaScript objects to scripts embedded in HTML pages."

Source: http://www.riverbankcomputing.co.uk/software/pyqt/intro

Also, do not give up hope if that does not do the trick, as there is also "Pyjamas" which is very handy! Here is a brief description of it:

"Pyjamas is a Rich Internet Application (RIA) Development Platform for both Web and Desktop.

It contains a Python-to-Javascript compiler, an AJAX framework and a Widget Set API. Pyjamas started life as a Python port of Google Web Toolkit, the Java-to-Javascript compiler. Read the FAQ and the list of features."

source: http://pyjs.org

found via: google.com

I would say that when you are always looking to see what the best to use is, ask your question in google, and look on multiple sites and compare the top results of multiple sites to your question, also, it really depends on what you need and what your strong hand plays better in.

Upvotes: 0

Related Questions