Run Python Programs as Web Applications locally on your Machine with Xampp - No Frameworks | Kovolff

preview_player
Показать описание
To be able to run your Python programs as web applications, just implement the steps below:

1. Download and Install Xampp
Xampp is a software which acts as a web server on your local machine

2. Download and Install Python
This is obvious, as without Python installed, you cannot run any Python programs

3. Go to your Xampp folder and then
Any line commencing with # signifies a comment

AddHandler cgi-script .py
ScriptInterpreterSource Registry-Strict

This enables Xampp to handle .py scripts aka your Python programs.

6. Lastly you can change the location of your root / public folder. This is the folder where you place your Python programs for Xampp to serve them as web applications.

Search for the string DocumentRoot. You will see that Xampp uses by default the directory htdocs. You can change that to any other directory on your drive. It does not have to be within the Xampp directory.

7. In your Python code insert in the first line the path to your Python installation preceded by #!,

8. Before you utilize any print statement in your Python code, ensure that your script outputs HTML. This is done with: print(‘Content-Type: text/html’)
Рекомендации по теме
Комментарии
Автор

I'm trying to use Selenium with this api but it stops running the code after I import selenium. I also can't import the api variables to another file because it gives me an error that has something to do with the Query String. Please help

ramoff
Автор

Forbidden
You don't have permission to access this resource.

Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.4.12 Server at localhost Port 80



please solve this

humayunahmed
Автор

Hi, please help me with this. Getting the below error when i restart the server.
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details
On running "systemctl status httpd.service":
Invalid command 'ScriptInterpreterSource', perhaps misspelled or defined by a module not include...guration

jayadas
Автор

This isn't working for me, the browser is just printing out everything i wrote in the editor instead of displaying 'Hi Guys' I have put the path to my python exe file but it still fails, can you help me.

JonnyRootsDem
Автор

Hello. Do you know if it can support modules as 'speech recognition' ?
Thank God bless you

javiermanjarresbaldovino
Автор

i did everything as uh have told but still getting internal server error

mayankkatare
Автор

I get *[cgi:error]: (OS 5)Access is denied.* in my appache error log file

abubakarbakhtiar
Автор

Hi. I cannot save httpd as a conf file. Does anyone know the reason? It said access was denied.

katherinmoller
visit shbcf.ru