MCPcopy
hub / github.com/django/django / setup

Function setup

django/__init__.py:8–24  ·  view source on GitHub ↗

Configure the settings (this happens as a side effect of accessing the first setting), configure logging and populate the app registry. Set the thread-local urlresolvers script prefix if `set_prefix` is True.

(set_prefix=True)

Source from the content-addressed store, hash-verified

6
7
8def setup(set_prefix=True):
9 """
10 Configure the settings (this happens as a side effect of accessing the
11 first setting), configure logging and populate the app registry.
12 Set the thread-local urlresolvers script prefix if `set_prefix` is True.
13 """
14 from django.apps import apps
15 from django.conf import settings
16 from django.urls import set_script_prefix
17 from django.utils.log import configure_logging
18
19 configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
20 if set_prefix:
21 set_script_prefix(
22 "/" if settings.FORCE_SCRIPT_NAME is None else settings.FORCE_SCRIPT_NAME
23 )
24 apps.populate(settings.INSTALLED_APPS)

Callers 1

Calls 3

configure_loggingFunction · 0.90
set_script_prefixFunction · 0.90
populateMethod · 0.45

Tested by 1