How to upload Python website to hosting

Installing Python
  1. After entering the control panel, go to the "System> SSH terminal" page and enter the username and password of your control panel in the displayed terminal (log in).
  2. To install the PIP package, type the following command in the terminal "sudo apt-get update -y && sudo apt-get install python3-pip -y".
  3. To check your Python version, enter the following command in the terminal "python3 --version"
  4. To install the Flask package, type the following command in the terminal "sudo pip3 install flask".
  5. To support UTF8 encoding, type the following command in the terminal "export LC_ALL=C.UTF-8 && export LANG=C.UTF-8".
Launching the Python test program
  1. By typing the following command in the terminal "sudo mkdir /python_hello_world && sudo chmod 777 /python_hello_world && cd /python_hello_world" Create a folder where we will then create a Python test program.
  2. By typing the following command in the terminal "sudo printf "from flask import Flask\napp = Flask(__name__)\n@app.route('/')\ndef home():\n    return 'Howdy world'" > /python_hello_world/hello_world.py" Create a Python test program file (/python_hello_world/hello_world.py).
  3. To run the Python test program, type the following command in the terminal "FLASK_APP=/python_hello_world/hello_world.py flask run --port=4000>/dev/null 2>&1 &".
  4. In case of server reboot to automatically start Python program, go to the next page "System > SSH terminal"  and in the text field below the terminal (The script runs automatically when the system starts) type the following command "FLASK_APP=/python_hello_world/hello_world.py flask run --port=4000>/dev/null 2>&1 &" and click "Save" button.
  5. To be able to open the Python program in a browser, go to the next page "Domain > HTTP Reverse proxy" and select the desired domain or subdomain with which you want to open the Python program, also in the field "Redirects to" type the following address "http://localhost:4000" and click "Create".
  6. Wait 5 minutes and log in to your chosen domain or subdomain with the browser, after which the Python program will open.



  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to upload NodeJS website to hosting

Installing NodeJS After entering the control panel, go to the "System> SSH terminal" page and...

Web Hosting Control Panel

Web Hosting Control Panel allows you to manage server configurations (domains, email, databases,...

How to change MySQL database settings

If you are not satisfied with the current MySQL database configuration and want to modify it,...

Change web hosting configuration (Upgrade or Downgrade settings)

To change (Upgrade or Downgrade) your web hosting configuration, go to the Services page  and...

How to install a new PHP module

All available PHP modules can be enabled/disabled in the Control Panel on the "System> PHP...