Here are the examples of the python api django.conf.settings.configure taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
59 Examples
3
View Complete Implementation : command_utils.py
Copyright MIT License
Author : aoldoni
Copyright MIT License
Author : aoldoni
def setup_django_template_system():
"""Initialises the Django templating system as to be used standalone.
"""
settings.configure()
settings.TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates'
}
]
django.setup()
3
View Complete Implementation : setup.py
Copyright MIT License
Author : datadesk
Copyright MIT License
Author : datadesk
def run(self):
import django
from django.conf import settings
from django.core.management import call_command
settings.configure(
DATABASES={
'default': {
'NAME': 'test',
'USER': 'postgres',
'ENGINE': 'django.contrib.gis.db.backends.postgis'
},
},
MEDIA_ROOT="media",
INSTALLED_APPS=("anss",),
)
django.setup()
call_command('test', 'anss')
3
View Complete Implementation : deeru_admin.py
Copyright GNU General Public License v3.0
Author : gojuukaze
Copyright GNU General Public License v3.0
Author : gojuukaze
def run():
settings_path = os.path.join(os.getcwd(), 'deeru')
settings_py = os.path.join(settings_path, 'settings.py')
if os.path.exists(settings_py):
sys.path.insert(0, os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'deeru.settings'
else:
settings.configure(INSTALLED_APPS=['deeru_cmd.apps.DeerUCmdConfig'])
management.execute_from_command_line()
3
View Complete Implementation : conftest.py
Copyright MIT License
Author : hishnash
Copyright MIT License
Author : hishnash
def pytest_configure():
settings.configure(
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'channels',
'tests'
),
SECRET_KEY='dog',
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
MIDDLEWARE_CLastES=[]
)
3
View Complete Implementation : setup.py
Copyright MIT License
Author : ivelum
Copyright MIT License
Author : ivelum
def run(self):
from django.conf import settings
settings.configure(
DATABASES={'default': {
'NAME': ':memory:',
'ENGINE': 'django.db.backends.sqlite3'}
},
INSTALLED_APPS=('django_uidfield', 'django.contrib.contenttypes')
)
from django.core.management import call_command
import django
django.setup()
call_command('test', 'django_uidfield')
3
View Complete Implementation : migrate.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : kogan
Copyright BSD 3-Clause "New" or "Revised" License
Author : kogan
def migrate(name):
from django.conf import settings
settings.configure(**SETTINGS_DICT)
import django
django.setup()
from django.core import management
management.call_command("makemigrations", "subscriptions", name=name)
3
View Complete Implementation : runtests.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : kogan
Copyright BSD 3-Clause "New" or "Revised" License
Author : kogan
def run_tests():
# First configure settings, then call django.setup() to initialise
from django.conf import settings
settings.configure(**SETTINGS_DICT)
import django
django.setup()
# Now create the test runner
from django.test.utils import get_runner
TestRunner = get_runner(settings)
# And then we run tests and return the results.
test_runner = TestRunner(verbosity=2, interactive=True)
failures = test_runner.run_tests(["tests"])
sys.exit(failures)
3
View Complete Implementation : conftest.py
Copyright MIT License
Author : labd
Copyright MIT License
Author : labd
def pytest_configure():
settings.configure(
COGNITO_AWS_REGION="eu-central-1",
COGNITO_USER_POOL="bla",
COGNITO_AUDIENCE="my-client-id",
INSTALLED_APPS=["django.contrib.auth", "django.contrib.contenttypes"],
MIDDLEWARE_CLastES=[],
CACHES={
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "unique-snowflake",
}
},
DATABASES={
"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "db.sqlite"}
},
ROOT_URLCONF="urls",
)
3
View Complete Implementation : conftest.py
Copyright GNU Lesser General Public License v3.0
Author : luxcem
Copyright GNU Lesser General Public License v3.0
Author : luxcem
def pytest_configure():
from django.conf import settings
settings.configure(
DEBUG_PROPAGATE_EXCEPTIONS=True,
DATABASES={
"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}
},
SITE_ID=1,
SECRET_KEY="fake-key",
INSTALLED_APPS=(
"django.contrib.auth",
"django.contrib.contenttypes",
"django_und",
"tests",
),
)
3
View Complete Implementation : makemigrationsrunner.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : mattiaslinnap
Copyright BSD 3-Clause "New" or "Revised" License
Author : mattiaslinnap
def main(args):
# Since this test suite is designed to be ran outside of ./manage.py test, we need to do some setup first.
import django
from django.conf import settings
settings.configure(INSTALLED_APPS=['testmigrationsapp'], DATABASES=DATABASES)
django.setup()
management.call_command('makemigrations', 'testmigrationsapp', verbosity=0)