Read custom parameters in django

Write custom parameters
in the settings.py configuration file Custom parameters IP_LOCAL ( variable letters need to be capitalized )
in the view function views
from django.conf import settings
print(settings.IP_LOCAL)

The second way is to directly import
the settings file and treat settings.py as a general python module

Guess you like

Origin blog.csdn.net/xiaoxiaodechongzi/article/details/104397247