Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a simple python web application [closed]

Tags:

I have a python script that takes inputs from commandline. I simply want to modify this script so I can run it on web. I want the commandline interface to be replaced by a simple boxes in a web page, and once the script is executed, I want the results to be shown on a webpage like it does in commandline.

Any help on where to start, which python packages to use and which steps to take would be much appreciated.

Until now, I read a little about webapp2 for Google App Engine and web.py. I do not want to use Django.

Thank you!

like image 691
AlpU Avatar asked Aug 09 '16 22:08

AlpU


2 Answers

While you can use a microframework like Flask [1] for quickly getting started, you can get closer to the metal. Try learning about the HTTP protocol and implement your own server using the http module. Python 3's http.server contains a class SimpleHTTPServer [2] which can be very good for understanding how you're communicating between the client and your process.

[1] http://flask.pocoo.org/docs/0.12/quickstart/

[2] https://docs.python.org/2/library/simplehttpserver.html

like image 68
Matias Faure Avatar answered Sep 23 '22 16:09

Matias Faure


Have you considered using Flask?

http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

This is a pretty great tutorial on how to make a basic webapp.

like image 38
Devasta Avatar answered Sep 24 '22 16:09

Devasta