Application Settings

Application-specific settings.

class cloud_browser.app_settings.BoolSetting(**kwargs)

Boolean setting..

env_clean(value)

Clean / convert environment variable to proper type.

classmethod parse_bool(value, default=None)

Convert string or bool to bool.

class cloud_browser.app_settings.Setting(**kwargs)

Settings option helper class.

env_clean(value)

Clean / convert environment variable to proper type.

get(name, default=None)

Get value.

validate(name, value)

Validate and return a value.

class cloud_browser.app_settings.Settings

Cloud Browser application settings.

This class wraps the “real” Django settings object, so can be used instead. The additional cloud browser settings are as follows:

Note

Environment Variables: Certain credential settings can come from OS environment variables instead of from a settings file value to open up more options for secrets management. Values that can be set in the environment are designated with an “(Env)” notation.

Setting a value this way could be done, e.g.:

$ export CLOUD_BROWSER_AWS_ACCOUNT="my_account"
$ export CLOUD_BROWSER_AWS_SECRET_KEY="my_secret"
$ # ... start django application with environment variables.

Datastore Settings:

  • CLOUD_BROWSER_DATASTORE: Choice of datastore (see values below).

Apache Libcloud: Configure Apache Libcloud as backing datastore.

  • CLOUD_BROWSER_DATASTORE = "ApacheLibcloud"

  • CLOUD_BROWSER_APACHE_LIBCLOUD_PROVIDER: Provider name. (Env)

  • CLOUD_BROWSER_APACHE_LIBCLOUD_ACCOUNT: Account name. (Env)

  • CLOUD_BROWSER_APACHE_LIBCLOUD_SECRET_KEY: Account secret. (Env)

Amazon Web Services: Configure AWS S3 as backing datastore.

  • CLOUD_BROWSER_DATASTORE = "AWS"

  • CLOUD_BROWSER_AWS_ACCOUNT: Account name. (Env)

  • CLOUD_BROWSER_AWS_SECRET_KEY: Account API secret key. (Env)

Google Storage for Developers: Configure Google Storage as backing datastore.

  • CLOUD_BROWSER_DATASTORE = "Google"

  • CLOUD_BROWSER_GS_ACCOUNT: Account name. (Env)

  • CLOUD_BROWSER_GS_SECRET_KEY: Account API secret key. (Env)

Rackspace: Configure Rackspace Cloud Files as backing datastore.

  • CLOUD_BROWSER_DATASTORE = "Rackspace"

  • CLOUD_BROWSER_RACKSPACE_ACCOUNT: Account name. (Env)

  • CLOUD_BROWSER_RACKSPACE_SECRET_KEY: Account API secret key. (Env)

  • CLOUD_BROWSER_RACKSPACE_SERVICENET: Boolean designating whether or not to use Rackspace’s servicenet (i.e., the private interface on a Cloud Server). (Env)

  • CLOUD_BROWSER_RACKSPACE_AUTHURL: Alternative authorization server, for use, e.g., with OpenStack instead of Rackspace. (Env)

Filesystem: Configure simple filesystem mock datastore.

  • CLOUD_BROWSER_DATASTORE = "Filesystem"

  • CLOUD_BROWSER_FILESYSTEM_ROOT: Filesystem root to serve from.

View Permissions: A standard Django view decorator object can be specified, which is wrapped for all browsing / viewing view – for example, to limit views to logged in members, use login_required and for staff only, use staff_member_required. Note that either a real decorator function or a fully-qualifid string path are acceptable, so you can use, e.g., “django.contrib.admin.views.decorators.staff_member_required” instead which might help with certain settings.py import-order-related issues.

  • CLOUD_BROWSER_VIEW_DECORATOR: View decorator or fully-qualified string path.

Container Permissions: Cloud browser allows a very rudimentary form of access control at the container level with white and black lists. If the white list is set, only container names in the white list are allowed. If the white list is unset, then any container name not in the black list is permitted. All name matching is exact (no regular expressions, etc.).

  • CLOUD_BROWSER_CONTAINER_WHITELIST: White list of names. (Iterable)

  • CLOUD_BROWSER_CONTAINER_BLACKLIST: Black list of names. (Iterable)

General: Other settings.

  • CLOUD_BROWSER_DEFAULT_LIST_LIMIT: Default number of objects to diplay per browser page.

  • CLOUD_BROWSER_OBJECT_REDIRECT_URL: Custom URL to which to redirect when clicking on an object (defaults to showing object contents).

  • CLOUD_BROWSER_STATIC_MEDIA_DIR: If this applications static media (found in app_media) is served up under the settings.MEDIA_ROOT, then set a relative path from the root, and the static media will be used instead of a Django-based static view fallback.

DATASTORES = {'AWS', 'ApacheLibcloud', 'Filesystem', 'Google', 'Rackspace'}

Valid datastore types.

SETTINGS = {'CLOUD_BROWSER_APACHE_LIBCLOUD_ACCOUNT': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_APACHE_LIBCLOUD_HOST': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_APACHE_LIBCLOUD_PORT': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_APACHE_LIBCLOUD_PROVIDER': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_APACHE_LIBCLOUD_SECRET_KEY': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_APACHE_LIBCLOUD_SECURE': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_AWS_ACCOUNT': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_AWS_SECRET_KEY': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_CONTAINER_BLACKLIST': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_CONTAINER_WHITELIST': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_DATASTORE': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_DEFAULT_LIST_LIMIT': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_FILESYSTEM_ROOT': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_GS_ACCOUNT': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_GS_SECRET_KEY': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_OBJECT_REDIRECT_URL': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_RACKSPACE_ACCOUNT': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_RACKSPACE_AUTHURL': <cloud_browser.app_settings.BoolSetting object>, 'CLOUD_BROWSER_RACKSPACE_SECRET_KEY': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_RACKSPACE_SERVICENET': <cloud_browser.app_settings.BoolSetting object>, 'CLOUD_BROWSER_STATIC_MEDIA_DIR': <cloud_browser.app_settings.Setting object>, 'CLOUD_BROWSER_VIEW_DECORATOR': <cloud_browser.app_settings.Setting object>}

Settings dictionary of accessor callables.

property app_media_doc_root

Get application media document (file) root.

property app_media_url

Get application media root from real media root URL.

container_permitted(name)

Return whether or not a container is permitted.

Parameters

name – Container name.

Returns

True if container is permitted.

Return type

bool