User Tools

Site Tools


sandbox_python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sandbox_python [2022/09/22 23:48] – [Python Web App] jhagstrandsandbox_python [2023/01/12 04:58] (current) – removed jhagstrand
Line 1: Line 1:
-====== sandbox python ====== 
- 
-===== Python Scripts ===== 
- 
-I can test my python script from the command line. \\ 
-python index.cgi \\ 
- 
-In the default a2hosting account, I can run any version of python. \\ 
-python --version \\ 
-python3 --version \\ 
-python3.7 --version \\ 
- 
-I can also create a virtual environment, in which I can use pip to install packages. \\ 
-Then I can use this environment to run cgi scripts. \\ 
- 
-===== Python Web App ===== 
- 
-We already have python cgi available, as in index.cgi. 
-But cgi is not an efficient way to run python. 
-So now we will setup a more modern python implementation. \\ 
-See a2hosting docs here. \\ 
-[www.a2hosting.com/kb/cpanel/cpanel-software/using-the-python-selector|How to use the Python Selector in cPanel] \\ 
-[[www.a2hosting.com/kb/developer-corner/python|Python Articles]] \\ 
- 
-==== Web Server Gateway Interface (WSGI) ==== 
- 
-In cPanel, Setup Python App, Create Application. 
- 
-Fill in the form thusly: 
- 
-  * Python version:  3.7.12 
-  * Application root:  /home/username/webprod/sandbox/sandbox/html/pvc 
-  * Application URL: sandbox.voyc.com/pvc 
-  * Application startup file: passenger_wsgi.py   (default, created automatically) 
-  * Application Entry point: application    (default, the name of a function in the startup file) 
-  * Passenger log file: /home/username/logs/user/sandbox.py.log 
- 
-Evidently this is Phusion Passenger. \\ 
-From the URL we can call only one python function: the Entry Point in the Startup File. \\ 
-Page navigation must be handled by the entry point function. \\ 
-Presumably one could create multiple applications on one subdomain? \\ 
- 
-The Application Root is similar to DocRoot. \\ 
-The setup creates this folder and installs the startup file and three folders. \\ 
-passenger_wsgi.py  public/  __pycache__/  tmp/ \\ 
- 
-This application can be stopped, restarted, and destroyed from the cPanel page. \\ 
-I sometimes need to do a restart to make my program changes take effect.  \\ 
- 
-==== Virtual Environment ==== 
- 
-The cPanel, Setup Python App, program already created a virtual environment for this app. 
-Its location is /home/username/virtualenv/webprod/sandbox/sandbox/html/pvc/3.7. 
-This folder contains bin/, lib/, and lib64 folders. 
-To activate this enviroment offline. 
-source /home/username/virtualenv/webprod/sandbox/sandbox/html/pvc/3.7 
- 
-Then I can install packages using Pip, and these packages are available to the web app as well. 
- 
-==== websockets ==== 
- 
  
sandbox_python.1663904932.txt.gz · Last modified: 2022/09/22 23:48 by jhagstrand

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki