开发者

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 bu开发者_高级运维ild a nice front-end allowing it to interact with the normal Python underneath?


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


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.


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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜