Question
How to install Django applications in Plesk?
Answer
While it is not yet officially supported, it can be configured manually at your own risk & will.
Vote for adding Python support to the Plesk on our UserVoice.
Note: Here and forth Python 3.x will be used as a target Python version.
Prepare the server
Connect to the server via SSH and apply the steps according to the installed Linux distribution:
Ubuntu and Debian
- Install Python 3:
# apt install python3 python-is-python3 python3-venv
- Download and install the Python package manager from the official website:
# wget https://bootstrap.pypa.io/get-pip.py
# python3 get-pip.py - Install the virtualenv package for python to separate the application's environment:
# python3 -m pip install virtualenv
- Install Phusion Passenger, which will be used to run the application:
# plesk installer --select-release-current --install-component passenger
- Log into Plesk
- Enable passenger module in Tools & Settings > Apache Web Server (in case the application should be served by Apache)
- Create a new service plan in Service Plans to preconfigure the web-server
- Set the following configuration in Web Server tab:
- To have application served by Apache:
- Enable Proxy mode, if it is present
- Set the following Additional Apache directives (for HTTP and HTTPS) to enable processing:
PassengerEnabled On
- To have application served by nginx:
- Disable Proxy mode
- Set the following Additional nginx directives, to enable processing:
passenger_enabled on;
passenger_app_type wsgi;
passenger_startup_file passenger_wsgi.py;
- To have application served by Apache:
- Set the following configuration in Hosting Parameters tab:
- Enable SSH access to the server shell under the subscription's system user. Set shell to /bin/bash
Warning: Providing users with shell access might be insecure and may allow them to exploit OS vulnerabilities. Make sure that the server has the latest updates installed.
- Enable SSH access to the server shell under the subscription's system user. Set shell to /bin/bash
- Save the Service Plan and use it on subscriptions that should have Python applications installed
CentOS 7 and RHEL 7
- Add EPEL repository and install Python 3.6:
# yum install -y epel-release
# yum install -y python36 - Download and install the Python package manager from the official website:
# wget https://bootstrap.pypa.io/pip/3.6/get-pip.py
# python3.6 get-pip.py - Install Phusion Passenger, which will be used to run the application:
# plesk installer --select-release-current --install-component passenger
- Log into Plesk
- Enable passenger module in Tools & Settings > Apache Web Server (in case application should be served by Apache)
- Create a new service plan in Service Plans to preconfigure the web-server
- Set the following configuration in Web Server tab:
- To have application served by Apache:
- Enable Proxy mode, if it is present
- Set the following Additional Apache directives (for HTTP and HTTPS) to enable processing:
PassengerEnabled On
- To have application served by nginx:
- Disable Proxy mode
- Set the following Additional nginx directives, to enable processing:
passenger_enabled on;
passenger_app_type wsgi;
passenger_startup_file passenger_wsgi.py;
- To have application served by Apache:
- Set the following configuration in the Hosting Parameters tab:
- Enable SSH access to the server shell under the subscription's system user. Set shell to /bin/bash
Warning: Providing users with shell access might be insecure and may allow them to exploit…
- Enable SSH access to the server shell under the subscription's system user. Set shell to /bin/bash