65
Use from django.conf import settings
but mind that settings
is not a module. The documentation clearly explains that and your use case.
31
from django.conf import settings as conf_settings
project_path = conf_settings.PROJECT_PATH
- [Django]-Celery. Decrease number of processes
- [Django]-Django "You have unapplied migrations". Which ones?
- [Django]-Django values_list vs values
6
-
in
settings.py
addDOMAIN = "example.com"
-
views.py
from django.conf import settings DOMAIN = settings.DOMAIN
-
lets try to
output it
:print(DOMAIN) print(type(DOMAIN))
-
output will be
:example.com <class 'str'>
- [Django]-Get user profile in django
- [Django]-What is the function of the name parameter in django.urls.path?
- [Django]-How to do math in a Django template?
Source:stackexchange.com