1

If I built some useful piece of python code to e.g. scrape a website or to calculate something big, at some point I might want to add a GUI to my project. For this I could use Tk, Qt, Pygame or any python graphic/GUI framework.

Now I also want this tool to be usable by clients without the need for a python installation. Of course I could use something like py2Exe or py2Dmg. But wouldn't it be cooler to use a python-based web framework for this? Something like Django or Pyramid.

What would be the drawbacks of doing this? Can I just use the framework to execute my code on a server and only return the result? Or will this get tricky when there are multiple users?

0

2 Answers 2

1

Making a web UI will make it easier to extend, and update. But it will be another layer of complexity for you to deal with.

I recommend looking at the lightweight http://webpy.org/

    urls = (
        '/hello', 'hello'
    )
    app = web.application(urls, globals())

    class hello:        
        def POST(self, name):
            #call your script here

You can call this with POST localhost/hello

Benefits:

  • Portability: no installers, can access from anywhere.

  • Extensibility: easyer to modify the UI (if you know HTML/CSS) and easier to re-deploy your application.

drawbacks:

  • Complexity: you will need to understand HTML, CSS request/response etc, set up a webserver or shared hosting,

  • Security: don't make it public.

2
  • Thanks! I already have experience with Django so the complexity won't be to much of a problem. What's with security? Why would this construction be extra vulnerable? Commented Dec 6, 2013 at 15:46
  • if you make your web server accessible to the internet, people may try and attack it. There are all kinds of attacks to watch out for, it's probably best/easiest to set up a firewall to allow internal network access only owasp.org/index.php/Top_10_2013-Top_10 Commented Dec 6, 2013 at 15:53
0

If you use Django, I recommend looking at either of

  • django-tastypie. With it you can build simple REST-style interfaces to your code.
  • Celery. An asynchronous task framework

Since you mention calculating something bigyou are likely to need asynchronous processing. Celery is a great choice for that. It includes the ability to submit jobs via REST calls, and to check on their status.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.