1. 登入CPanel。
Login to CPanel.
cPanel登錄連結 login link : https://cpanel.yourdomainname/
2. 點撃 "Setup Python App"
Click "Setup Python App"
3. 點撃 "Create Application"
Click "Create Application"
4a. 選擇你想用的Python版本 (推薦最新版本)
Choose the Python version you wish to use (The latest version is recommended).
4b. 輸入python應用程式的安裝位置,如根目錄中不存在,將會自動創建
Enter the directory that the python application should be installed to. This is path is relative to the root directory and will create the specified directory if it does not exist.
4c. 輸入應用程式的位置,如果是使用你的域名直接連接的話,請留空
Enter the address the application should be located on. If it should accessible directly on your domain, leave the field blank.
4d. 輸入運行的檔案名稱,這必需與e點中的應用程式接入點吻合
Enter the name of the file to run. This must link "Application Entry Point" (see point e) with the application itself.
4e. 輸入應用程式接入點的變數名稱
Enter the Application Entry Point name of the variable.
4f. 輸入 Passenger 日誌的儲存路徑
This is the path to where the Passenger log file is written.
4g. 如需要,於此處新增環境變數
Environment variables can be added for python installation if needed.
4h. 當所有欄位都按需求填寫好後,點撃 "Create"
When all fields are filled in as desired, click "Create"
5a. 這些按鈕允許你保存或放棄修改,以及刪除整個應用程序
These buttons allow you to save or discard changes as well as delete the entire application.
5b. 這些按鈕允許你啟動、停止和重新啟動應用程序
These buttons allow you to start, stop and restart the application.
5c. 你可以為Python應用程序添加配置文件。
You can add configuration files for the python application.
5d. 如果你於c點添加了一個配置文件,例如用pip製作的 "requirements.txt",你可以通過按下這個按鈕來安裝。
If you have added a configuration file in step c, for example a "requirements.txt" made with pip, you can install the listed packages by pressing this button.
5e. 在這裡你可以運行位於伺服器上的python腳本。如果你不能訪問終端,而想運行python腳本進行設置,例如在Django中創建一個超級用戶。該腳本是在應用程序的虛擬環境中運行的。
Here you can run python script located on the server. If you do not have access to the terminal and want to run python script to do setup, for example to create a super user in Django. The script is run in the virtual environment of the application.