API documentation

Utilities to set up Django applications, both in Web and CLI environments.

django_pastedeploy_settings.resolve_local_conf_options(global_conf, local_conf)

Return the final values for the items in local_conf.

Raises:
  • ImportError – If the Django settings module cannot be imported.
  • UnsupportedDjangoSettingError – If local_conf contains a Django setting which is not supported.
  • MissingDjangoSettingsModuleError – If the django_settings_module option is not set.
  • BadDebugFlagError – If Django’s DEBUG is set instead of Paste’s debug.
Returns:

local_conf with its values deserialized from JSON and variable references resolved

Return type:

dict

The result also includes the following items:

  • DEBUG: Copied from global_conf['debug'].
  • paste_configuration_file: The path to the PasteDeploy configuration file used.
django_pastedeploy_settings.get_configured_django_wsgi_app(global_conf, **local_conf)

Load the Django application for use in a WSGI server.

Returns:The WSGI application for Django as returned by get_internal_wsgi_application().

Internally, this uses resolve_local_conf_options() and stores the result as Django settings. Any exceptions raised by that function are also propagated.

exception django_pastedeploy_settings.BadDebugFlagError
exception django_pastedeploy_settings.InvalidSettingValueError
exception django_pastedeploy_settings.MissingDjangoSettingsModuleError
exception django_pastedeploy_settings.SettingException
exception django_pastedeploy_settings.UnsupportedDjangoSettingError

Media serving

django_pastedeploy_settings.factories.add_media_to_app(django_app)

Return a WSGI application made up of the Django application, its media and the Django Admin media.