Is it possible to display a python result with react? - python

I want to write a program using python as logic, because of the extensive libraries available in python suited for this project, and to develop the UI using react.
Is this at all possible, or is there a different method which is easier?

if you want to use react as a front end for a website, you could run python as the back end using something like flask or Django. Python can't be run in the browser, you'll need to run python on a server or run in locally on your machine if the project is just for you.

Related

How do I run python script within swift app?

I am making an app which will login to a website and scrape the website for the information I have. I currently have the all the login and web scraping written in Python completely done. What I am trying to figure out is running that python code in Xcode in my swift project. I want to avoid setting up a server capable of executing cgi scripts. Essentially the user will input their credentials and I will pass that to the python file, and the script will run.
Short answer: You don't.
There is no Python interpreter running on iOS, and Apple will likely neither provide nor allow one, since they don't allow you to deliver and run new code to in iOS app once it's installed. The code is supposed to be fixed at install time, and Python is an interpreted language.

can i use django to access folders on my pc using same os.path for windows?

I have a python algorithm that access a huge database in my laptop. I want to create a web server to work with it. can I use django with the folder paths I have used ? like how do I communicate with it ? I want to get an image from web application and get it sent to my laptop and run algorithm on it then send result back to the webserver. would that still be possible without me changing my algorithm paths? like I use os.path to access my database folder, would I still be able to do what with django or shall I learn something else? I wanted to try django as it runs in python and I can learn it easy.
I have found out that django works fine with os.path and no problems. actually if you are programming with python then django is a great choice for server work.

How to make a web app for simple python text processing

I have made a python program which does some text processing to whatever input I give and for now run I it simply by our terminal window(cmd). But now we want to make a simple web app which takes the input from user and then my application processes it and then the result is shown to user. Something like http://textanalysisonline.com/simple-text-summarizer.
As i am new to all this any help would be appreciated. thanks
I suggest looking into using Django - A framework for making python (web) applications.
I would look into downloading the python IDE PyCharm as it makes Django development quite easy and then look into some tutorials on how to make Django applications.
then I would install Django and then follow the tutorials (maybe start here) for figuring out how to add your script to a Django application. Happy coding!

Running a Python Script on my website?

I have a website with miniwebhost.com, which supports python. I want to have a page that runs one of my text based games I have made on Python. So, how would I go about doing it? I know I have to make it executable and something about a cgi-bin(which I have). Put your answer in clear steps please.
Site is: www.rosshudson.co.uk/
Python web applications are often hooked to the web server (e.g. Apache httpd) using the WSGI module. Note that your app need to handle the HTTP requests correctly either by using a framework (like Django) or the BaseHttpServer, BaseHttpRequestHandler from the standard library.

cgi scripts with no server

My goal is to use to make it easy for non-programmers to execute a Python script with fairly complex options, on a single local machine that I have access to. I'd like to use the browser (specifically Safari on OS X) as a poor man's GUI. A short script would process the form data and then send it on to the main program(s).
I have some basic examples of python scripts run using the built-in Apache server, by clicking submit on a form whose html is th:
e.g. here. What I want to do now is do it without the server, just getting the form to invoke the script in the same directory. Do I have to learn javascript or ...? I'd be grateful for any leads you have. Thanks.
It doesn't make sense -- what a browser does when it submits a form by definition is to make a request to a web server.
If all that's going on is that you don't want to be running Apache, you could hook something simple up using the CGIHTTPServer class that's provided as part of the Python Standard library.
If you don't want a server process at all, and you're using a suitably modern browser, you may want to look at using HTML5 local storage, but that's not a Python solution.
Well, there always has to be some kind of "server" involved to communicate over HTTP. You could have a python script listening on port 80 on your machine, that in turn runs the scripts specified with the form's action attribute.
You won't get away without some sort of server, I'm afraid.
PS: There are already a couple of good minimalistic python HTTP servers that would do the trick. Just google for it.
Regards, aefxx
Pyjamas Desktop will allow you to deploy a browser-based desktop application.

Categories

Resources