skyWalking Python agent requires SkyWalking 8.0+ and Python 3.7+
bash
# 将django包导入
~$ cd /apps
~$ tar xf django-test.tgz
~$ cd django-test
# 安装模块
~$ apt install python3-pip
~$ pip3 install -r requirements.txt
# 创建django项目mysite
~$ django-admin startproject mysite
# 创建应用
~$ cd mysite
~$ python3 manage.py startapp myapp
# 初始化数据库
~$ python3 manage.py makemigrations
~$ python3 manage.py migrate
# 创建管理员,用于登录admin
~$ python3 manage.py createsuperuser
# skywaking环境变量
export SW_AGENT_NAME='python'
export SW_AGENT_NAMESPACE='python'
export SW_AGENT_COLLECTOR_BACKEND_SERVICES='192.168.58.152:11800'
# 修改配置
~$ vim mysite/settings.py
ALLOWED_HOSTS=['127.0.0.1','192.168.58.153']
# 启动app服务
~$ sw-python -d run python3 manage.py runserver 192.168.58.153:80
# 访问 http://192.168.58.153:80/admin
验证skywalking界面