Recursion
Recursion

Reputation: 3091

Web frontend for a Python application

I created a nice RSS application in Python. It took a while and most of the code just does heavy work, like formatting XML, downloading feeds, etc. To the application itself requires very little user interaction, just a initial list of RSS feeds and some parameters.

What would be really nice, is if I was able to have a web front-end which allowed me to have the user edit their feeds and parameters, then they could click a create button and it runs.

I don't really want to have to rewrite the thing in a web framework. Is there anything that will allow me to build a nice front-end allowing it to interact with the normal Python underneath?

Upvotes: 1

Views: 10489

Answers (3)

B--rian
B--rian

Reputation: 5880

You may also either deploy your Python code as CGI script on a webserver of your choice, e.g. Tomcat:

The CGI (Common Gateway Interface) defines a way for a web server to interact with external content-generating programs, which are often referred to as CGI programs or CGI scripts.

According to a Qura-question this might be appropriate only for small projects, but I do not say anything wrong with that since it worked well for me for perl-scripts. The same source suggests a Python WSGI (web-service gateway) service like uwsgi another service dedicated to running Python code.

Last but not least, there is the solution to encapsulate your Python into Java-code: I stumbled upon the Quora-question "How do I run Java and Python in Tomcat?" which refered to using Jython and plyJy, the latter project is not alive anymore. However, there is also a related question on the topic of bundling Python and Java..

Upvotes: 0

bluszcz
bluszcz

Reputation: 4128

It depends on your needs, free time, etc.

I recommend two solutions:

  • Django - a very rich framework which allows you to create full featured sites using only accessible components (in most cases they are good enough)
  • http://werkzeug.pocoo.org/ - collections of tools if you want to have possibility to control everything from the low level

Upvotes: 5

Noufal Ibrahim
Noufal Ibrahim

Reputation: 72865

web.py is a very lightweight 'library' (not framework) that you can put as a front end to your app. Just import your app within the main controller and use it as you would.

The Python standard library also includes a builting SimpleHTTPServer module which might be what you need to create a front end for your app.

Upvotes: 3

Related Questions