Creating a virtual environment for your project
When working with Python projects, it's always a good idea to create a virtual environment. This allows you to create an isolated environment, separate from the system version of Python. Any changes you make to this virtual environment only affects the single project, nothing else. In this way, it's a very safe way to test your projects as they can be deleted and rebuilt very easily. View the following article for further details.
This is important if you want to run 'pip'. Normally, pip attempts to install in the server's default Python system folder. This does not work since you do not have access to this folder. When you create a virtual environment, pip installs locally under your user, so you'll be able to install anything you like without error.
In order to install various Python packages, and Django in particular, you'll want pip. This is pre-installed on shared servers, but if necessary, you can use the following to download:
[server]$ curl https://bootstrap.pypa.io/get-pip.py > ~/tmp/get-pip.py python ~/tmp/get-pip.py --user
Installing custom modules
It’s recommended that you use pip (in your virtual environment) to easily install custom modules. For example:
(my_project) [server]$ pip install <module>
For example, (e.g., mysqlclient if you're going to use a MySQL database) for your website using pip:
(my_project) [server]$ pip install mysqlclient
View the following links for further details:
If you're using Python 3
If you're using Python 3, use the 'pip3' command instead. For example:
(my_project) [server]$ pip3 install mysqlclient
View the following article for further details: