In a.py
,I imported django's settings.py
,I Need to Modify settings.DEBUG
.
but how to do it in python script?
I did this but nothing changed , settings.DEBUG=False
https://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime I think this is you want.
Just like it saied:
from django.conf import settings
settings.DEBUG = True # Don't do this!
The only place you should assign to settings is in a settings file.
Good luck!
You might want to do a bit of research about different ways of doing 'local' settings for django.
There are lots of different ways. The way I do it is described in detail at Modular Django Settings .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.