Run the following commands
mypyapp@CloudPanel$ cd htdocs
mypyapp@CloudPanel:~/htdocs$ python3 -m venv venv
mypyapp@CloudPanel:~/htdocs$ source venv/bin/activate
mypyapp@CloudPanel:~/htdocs$ pip install django
mypyapp@CloudPanel:~/htdosc$ django-admin --version
mypyapp@CloudPanel:~/htdocs$ pip install pymysql
mypyapp@CloudPanel:~/htdocs$ cd mypyapp.cc
mypyapp@CloudPanel:~/htdocs/mypyapp.cc$ django-admin startproject myapp
mypyapp@CloudPanel:~/htdocs/mypyapp.cc$ cd myapp
mypyapp@CloudPanel:~/htdocs/mypyapp.cc$ python3 manage.py migrate
mypyapp@CloudPanel:~/htdocs/mypyapp.cc$ python3 manage.py runserver
#mypyapp@CloudPanel$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config
#mypyapp@CloudPanel$ pip install mysqlclient
Directory Structure
htdocs
mypyapp.cc
myapp
myapp
venv
static

Create a new file as a root: /etc/uwsgi/apps-enabled/mypyapp.cc.uwsgi.ini
Then add the below content to the file mypyapp.cc.uwsgi.ini
[uwsgi]
plugins = python3
master = true
protocol = uwsgi
# Django-related settings
# the base directory (full path)
chdir = /home/mypyapp/htdocs/mypyapp.cc/myapp/
# Django's wsgi file
module = myapp.wsgi
# the virtualenv (full path)
home = /home/mypyapp/htdocs/mypyapp.cc/venv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = 127.0.0.1:8090
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
uid = mypyapp
gid = mypyapp
Run uWsgi to debug:
mypyapp@CloudPanel$ cd /etc/uwsgi/apps-enabled/
mypyapp@CloudPanel$ uwsgi --ini mysite_uwsgi.ini
Start the uWsgi service
mypyapp@CloudPanel$ systemctl start uwsgi
Update the vhost file as below
location / {
include proxy_params;
proxy_pass http://127.0.0.1:8090;
}
Add static files location in the Nginx config file
location /static {
alias /home/mypyapp/htdocs/mypyapp.cc/myapp/myapp/static; # your Django project's static files - amend as required
}