Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

Django Runtime System Check


ขณะสร้างเว็บ Django บางครั้งต้องการ URL endpoint ตรวจสอบ database, cache, storage ใช้แพ็กเกจ協力廠商ตรวจสอบประสิทธิภาพระบบและสิ่งต่างๆ แม้ใน production ก็ตรวจสอบได้

ตัวอย่าง

ตั้งค่าแอปและ urls พื้นฐาน

ติดตั้ง django-watchman:

pip install django-watchman

ใน settings.py:

INSTALLED_APPS = (
    ...
    'watchman',
)

เพิ่ม watchman เป็นแอป

ใน urls.py:

urlpatterns += [path(r'watchman/', include('watchman.urls')),]

กำหนด URL endpoint สำหรับ system check

เอาต์พุต

ที่ https://127.0.0.1/watchman/dashboard/

Django Runtime System Check