- Login to cPanel.
- Under the Software section, locate and click on Setup Python App.
- Click on the Create application button.
- Select a Python version and provide the required information.
From 2 above,
- Choose the python version you wish to use.
- Enter the directory that the python application should be installed to. This is path is relative to the root directory of the web hotel and will create the specified directory if it does not exist.
- Enter the address the application should be located on. If it should accessible directly on your domain, leave the field blank.
- Enter the name of the file to run. This must link "Application Entry Point" (see point 5) with the application itself.
For example, assuming that this example runs a Flask server, this can be done by defining "app = Flask (__ name__)" in the specified file.
- Enter the name of the variable containing the server.
- This is the path to where the Phusion Passenger log file is written.
- Here environment variables can be added for python installation if needed.
- When all fields are filled in as desired, press the "Create" button to set up the application.
When done, you should have something akin to image below.
You can now make changes and manage the python application by doing the following.
- This is the command you input in the terminal to enter the virtual environment that is set up for the application. To install packages through pip, this command must be run first.
- These buttons allow you to start, stop and restart the application.
- If you have added a configuration file (ref. Point 4), for example a "requirements.txt" made with pip, you can install the listed packages by pressing this button.
- Here you can add configuration files for the python application.
- Here you can run python script located on the webhosting. This is useful 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.
- These buttons allow you to save or discard changes as well as delete the entire application.
Step 5: Done.
You have successfully learned how to create a python application on Tucana, including how to manage, update, and delete the environment.