Is it possible to run python script, which I will upload on Heroku or DG Ocean droplet (depending on which of them is most comfortable for what I am trying to do), from external website button?
My scenario: I have scrapper and I want to run it when user clicks on button on my webpage, so scrapper will scrape current data and will show it to user. Is it possible to do? or if we have any other way?
For others, who will have same things in the feature: So, i am going to make FLASK app to use DG Droplet or Heroku, after i will import Flask app using Iframe in my Web project and use only BUTTON, like this i will use my scraper on my Webpage.
Thanks
I’m working on this face recognition app, so I am using android studio as front-end and python as a back-end.Upon designing my UI in android studio, I want to make a button in a way when i press it , my python script runs. If someone can help me I’d be very grateful.
Thanks in advance
What I think you need to do is run your python script on a server,
Then make a GET request from your app, on click or whatever, then out the response (generally in JSON) from your script.py
i need a solution for my apache python problem.
I have an apache web server with a page full of buttons and they are supposed to perform different functions and actions in a python script on the server.
The page should not reload when you activate a button. Is there a way to make the button click work for python? So to say that python listens if there was a button click? But I don't want to run the webserver on pyhton.
Since I have no experience with such a complex thing, I wanted to ask for advice. I hope the problem is understandable and there is a simple solution
I finished up some python tutorials and would like to go a bit further. I can open the IDLE and execute the code just fine by pressing f5 (save and run) on my desktop but that is the limit of my abilities. I would like to be able to execute the programs on a webpage
I tried simply uploading the file to my server, then browsing to it in chrome. I'm sure you know what happened: the url displayed text on the screen.
Since I am brand new to python, I am not sure where to start or even what questions to ask. Basically I would like to run the program in the browswer as if the browswer was the IDLE, or better yet, create an html/css button that runs the program when clicked.
I'd advise you to look into something like flask. It's a micro-framework that includes a basic web server. The documentation should get you most of the way that you want to go.
Running python on the web usually means that when you hit an URL, the server runs some kind of python script, and returns a string - the HTML content of the page you're requesting. You can't use python to 'script' the webpage as you'd use javascript.
You can run python in an interactive interpreter running within a webpage though - just check out try ipython.
Flask is good.
Cherrypy - http://www.cherrypy.org/ - is also a great choice for a really simple way to run python on the server.
Fundamentally, you just configure your web server to execute the file instead of display it. Typically you set this for *.py files but you could restrict it, say, to files in a particular directory. Apparently, your server already has such a setting for PHP files.
Wrapping Python with PHP (obviously) adds neither speed nor security or utility.
Down the line you might want to look at frameworks, mod_python, WSGI, etc, but for your immediate problem, those are severe overkill.
This is limited to static server-side code; JavaScript runs interactively in the visitor's browser, allowing for much richer user interaction. A server-side script runs when the browser attempts to load the page, and the page load finishes when the script is done. If you want something like IDLE in your browser, that's a JavaScript challenge rather than a Python task (and that particular wheel has already been invented, productized, marketed, and sold to the Americans: http://pythonfiddle.com/)
like this:
python -c "import urllib2; exec urllib2.urlopen("http://localhost:8000/test.py").read()"
I'm already implement a command line tool used for 802.1x authentication in python. But I want a gui frontend. I want to try a web UI this time, but I don't know how to let my webui communicate with my python app.
I only know that I need to open a socket in CLI program and receive the message send by the web ui. But I'm a newbie in web development. I don't known what to do with my web app.
Do you have any good advice? Thanks in advance.
Python official wiki page about web programming and the wikipedia list of the web frameworks written in Python are good places to start from.