Python os.environ.setdefault() Examples
The following are 6
code examples of os.environ.setdefault().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
os.environ
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: config.py From arch-security-tracker with MIT License | 5 votes |
def set_debug_flag(debug): global FLASK_DEBUG FLASK_DEBUG = debug environ.setdefault('FLASK_DEBUG', '1' if FLASK_DEBUG else '0') config_flask['debug'] = 'on' if debug else 'off'
Example #2
Source File: setup.py From byro with Apache License 2.0 | 5 votes |
def run(self): environ.setdefault("DJANGO_SETTINGS_MODULE", "byro.settings") try: import django except ImportError: # Move to ModuleNotFoundError once we drop Python 3.5 return django.setup() from django.conf import settings from django.core import management settings.COMPRESS_ENABLED = True settings.COMPRESS_OFFLINE = True management.call_command("compilemessages", verbosity=1) management.call_command("collectstatic", verbosity=1, interactive=False) management.call_command("compress", verbosity=1) build.run(self)
Example #3
Source File: conftest.py From opentelemetry-python with Apache License 2.0 | 5 votes |
def pytest_sessionstart(session): # pylint: disable=unused-argument environ.setdefault("OPENTELEMETRY_PYTHON_DJANGO_INSTRUMENT", "True")
Example #4
Source File: cli.py From teamvault with GNU General Public License v3.0 | 5 votes |
def plumbing(pargs): environ['DJANGO_SETTINGS_MODULE'] = 'teamvault.settings' environ.setdefault("TEAMVAULT_CONFIG_FILE", "/etc/teamvault.cfg") execute_from_command_line([""] + pargs.plumbing_command[0].split(" "))
Example #5
Source File: cli.py From teamvault with GNU General Public License v3.0 | 5 votes |
def setup(pargs): environ.setdefault("TEAMVAULT_CONFIG_FILE", "/etc/teamvault.cfg") create_default_config(environ['TEAMVAULT_CONFIG_FILE'])
Example #6
Source File: cli.py From teamvault with GNU General Public License v3.0 | 5 votes |
def upgrade(pargs): environ['DJANGO_SETTINGS_MODULE'] = 'teamvault.settings' environ.setdefault("TEAMVAULT_CONFIG_FILE", "/etc/teamvault.cfg") print("\n### Running migrations...\n") execute_from_command_line(["", "migrate", "--noinput", "-v", "3", "--traceback"]) print("\n### Gathering static files...\n") from django.conf import settings try: rmtree(settings.STATIC_ROOT) except FileNotFoundError: pass mkdir(settings.STATIC_ROOT) execute_from_command_line(["", "collectstatic", "--noinput"]) print("\n### Updating search index...\n") execute_from_command_line(["", "update_search_index"])