2014-11-24 20:02:29 +08:00
|
|
|
from django.utils.version import get_version
|
2013-12-30 22:42:15 +08:00
|
|
|
|
2021-09-16 13:22:12 +08:00
|
|
|
VERSION = (4, 1, 0, "alpha", 0)
|
2013-12-30 22:42:15 +08:00
|
|
|
|
2014-09-10 02:26:03 +08:00
|
|
|
__version__ = get_version(VERSION)
|
|
|
|
|
|
|
|
|
2015-10-24 03:02:34 +08:00
|
|
|
def setup(set_prefix=True):
|
2013-12-31 19:28:01 +08:00
|
|
|
"""
|
|
|
|
Configure the settings (this happens as a side effect of accessing the
|
|
|
|
first setting), configure logging and populate the app registry.
|
2015-10-24 03:02:34 +08:00
|
|
|
Set the thread-local urlresolvers script prefix if `set_prefix` is True.
|
2013-12-31 19:28:01 +08:00
|
|
|
"""
|
2013-12-30 22:42:15 +08:00
|
|
|
from django.apps import apps
|
|
|
|
from django.conf import settings
|
2015-12-30 23:51:16 +08:00
|
|
|
from django.urls import set_script_prefix
|
2013-12-31 19:28:01 +08:00
|
|
|
from django.utils.log import configure_logging
|
|
|
|
|
|
|
|
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
|
2015-10-24 03:02:34 +08:00
|
|
|
if set_prefix:
|
|
|
|
set_script_prefix(
|
2017-03-04 22:47:49 +08:00
|
|
|
"/" if settings.FORCE_SCRIPT_NAME is None else settings.FORCE_SCRIPT_NAME
|
2015-10-24 03:02:34 +08:00
|
|
|
)
|
2013-12-31 06:15:29 +08:00
|
|
|
apps.populate(settings.INSTALLED_APPS)
|