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

Показать описание
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’)
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’)
Комментарии