Guide
Tutorial
uWsgi for application Server
uWsgi is a application Server of Python, you can use it to publish your Python Web application:
-
Install uWsgi for your isolated environment
cd /data/wwwroot/mydjango && source bin/activatepip install uwsgi -
Add uWsgi configuration file at your application directory, named it, e.g
django.ini[uwsgi]master = trueprotocol = uwsgihttp = 0.0.0.0:8001wsgi-file = mysite1/mysite1/wsgi.pychdir = /data/wwwroot/mydjangobuffer-size = 8192enable-threads= trueclose-on-exec = trueuid = nginxgid = nginx -
Start uWsgi Service
/data/wwwroot/mydjango/bin/uwsgi --ini /data/wwwroot/mydjango/django.ini -
Local computer browser access URL:http://Server's Internet IP:8001 to test it
Troubleshoot
django start error?
Error message: You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them.
Solution:
python manage.py migrate
Parameters
Path
Python site directory: /data/wwwroot
Python framework directory: /data/wwwroot
Python source code directory: /usr/lib/python
Python logs directory: /data/logs/python
Django installation directory: /data/wwwroot/django
Django systemd name: django
Version
# Python version
python3 -V
python -V
# pip version
pip -V
# Django version
/data/wwwroot/django/bin/pip show django
Service
systemctl start django
systemctl stop django
systemctl restart django
systemctl status django
CLI
- pip,
- django-admin
- python