web services - Run a Python Script from the Web -



web services - Run a Python Script from the Web -

i've been stumbling along same problem year now. find way work around it, i'm tired of finding work arounds.

what need create button on web page (preferable html, not php or asp) runs python script on server. i'd ability have button send info form script.

i need on local host , through web service hosted on amazon cloud. won't able install on amazon cloud service, such php or cgi.

i'd easy solution, i'm expert python , can write webpages whistle, can't find simple solution problem.

my ideal solution mail service tag:

<a href="mailto:someone@example.com?subject=hello%20again">send mail</a>

except:

<a href="myscript.py?subject=1234">run script</a>

now highly uncertainty solution exists, can dream right.

the script trying run:

returns unique id user sends id gis programme creates map based on id (the id selects area of map) the map exported png, wrote html document , displayed user in new tab.

edit ---------------------------

thanks @ketouem reply able find great solution issue. i'll post of code here others can benefit. create sure download bottle module python, great.

# 01 - import scheme modules bottle import get, post, request, bottle, run, template # 02 - script variables app = bottle() # 03 - build temporary webpage @app.route('/slr') def login_form(): homecoming '''<form method="post" action="/slr"> parcel fabric id: <input name="uid" type="text" /><br /> save location: <input name="savelocation" type="text" value="d:/python27/bottletest/slr_testoutputs"/><br /> air photo on: <input name="airphoto" type="checkbox"/><br /> open on completion: <input name="open" type="checkbox"/><br /> scale: <input name="scale" type="text" value="10000"/><br /> <input type="submit" /> </form>''' # 04 - homecoming gis app @app.route('/slr', method='post') def phph_slr_script(): # won't bother adding gis section of code, @ point send variables programme makes map. map saves xml , opens in new tab. # 04 - create , run page run(app, host='localhost', port=8080)

you utilize bottle : http://bottlepy.org/docs/dev/index.html lite web framework

python web-services web-applications web python-2.7

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

Hibernate criteria by a list of natural ids -

ios - Lagging ScrollView with UIWebview inside -