The openstack_dashboard.management.commands.migrate_settings ModuleΒΆ

class openstack_dashboard.management.commands.migrate_settings.Command(*args, **kwargs)[source]

Bases: django.core.management.base.BaseCommand

add_arguments(parser)[source]
file_time_fmt = '%Y%m%d%H%M%S%Z'
gendiff(force=False)[source]

Generate a diff between self.local_settings and the example file.

handle(*args, **options)[source]
help = 'Creates a local_settings.py file from the local_settings.py.example template.'
local_settings_diff = 'local_settings.diff'
local_settings_example = 'local_settings.py.example'
local_settings_file = 'local_settings.py'
local_settings_reject_pattern = 'local_settings.py_%s.rej'
patch(force=False)[source]

Patch local_settings.py.example with local_settings.diff.

The patch application generates the local_settings.py file (the local_settings.py.example remains unchanged).

http://github.com/sitkatech/pypatch fails if the local_settings.py.example file is not 100% identical to the one used to generate the first diff so we use the patch command instead.

time_fmt = '%Y-%m-%d %H:%M:%S %Z'
class openstack_dashboard.management.commands.migrate_settings.DirContext(dirname)[source]

Bases: object

Change directory in a context manager.

This allows changing directory and to always fall back to the previous directory whatever happens during execution.

Usage:

with DirContext('/home/foo') as dircontext:
    # Some code happening in '/home/foo'
# We are back to the previous directory.
openstack_dashboard.management.commands.migrate_settings.get_module_path(module_name)[source]

Gets the module path without importing anything.

Avoids conflicts with package dependencies. (taken from http://github.com/sitkatech/pypatch)

Previous topic

The openstack_dashboard.management.commands Module

Next topic

The openstack_dashboard.contrib Module

Project Source

This Page