Class: PoiseApplicationPython::Resources::Django::Resource

Inherits:
Chef::Resource
  • Object
show all
Includes:
AppMixin
Defined in:
lib/poise_application_python/resources/django.rb

Overview

An application_django resource to configure Django applications.

Examples:

application '/srv/myapp' do
  git '...'
  pip_requirements
  django do
    database do
      host node['db_host']
    end
  end
  gunicorn do
    port 8080
  end
end

Since:

  • 4.0.0

Instance Attribute Summary collapse

Instance Attribute Details

#allowed_hostsString+

Value for ALLOWED_HOSTS in the Django settings.

Returns:

  • (String, Array<String>)


73
# File 'lib/poise_application_python/resources/django.rb', line 73

attribute(:allowed_hosts, kind_of: [String, Array], default: lazy { [] })

#collectstaticBoolean

TODO:

This could auto-detect based on config vars in settings?

Set to false to disable running manage.py collectstatic during deployment.

Returns:

  • (Boolean)


79
# File 'lib/poise_application_python/resources/django.rb', line 79

attribute(:collectstatic, equal_to: [true, false], default: true)

#databaseHash

Option collector attribute for Django database configuration.

Examples:

Setting via block

database do
  engine 'postgresql'
  database 'blog'
end

Setting via URL

database 'postgresql://localhost/blog'

Returns:

  • (Hash)


90
# File 'lib/poise_application_python/resources/django.rb', line 90

attribute(:database, option_collector: true, parser: :parse_database_url, forced_keys: %i{name})

#debugBoolean

Note:

If you use this in production you will get everything you deserve.

Enable debug mode for Django.

Returns:

  • (Boolean)


96
# File 'lib/poise_application_python/resources/django.rb', line 96

attribute(:debug, equal_to: [true, false], default: false)

#groupString

Owner for the Django application, defaults to application group.

Returns:

  • (String)


100
# File 'lib/poise_application_python/resources/django.rb', line 100

attribute(:group, kind_of: String, default: lazy { parent && parent.group })

#local_settingsPoise::Helpers::TemplateContent

TODO:

Redo this doc to cover the actual attributes created.

Template content attribute for the contents of local_settings.py.

Returns:

  • (Poise::Helpers::TemplateContent)


105
# File 'lib/poise_application_python/resources/django.rb', line 105

attribute(:local_settings, template: true, default_source: 'settings.py.erb', default_options: lazy { default_local_settings_options })

#local_settings_pathString, nil false

Path to write local settings to. If given as a relative path, will be expanded against #path. Set to false to disable writing local settings. Defaults to local_settings.py next to #setting_module.

Returns:

  • (String, nil false)


112
# File 'lib/poise_application_python/resources/django.rb', line 112

attribute(:local_settings_path, kind_of: [String, NilClass, FalseClass], default: lazy { default_local_settings_path })

#manage_pathString

Path to manage.py. Defaults to scanning for the nearest manage.py to #path.

Returns:

  • (String)


122
# File 'lib/poise_application_python/resources/django.rb', line 122

attribute(:manage_path, kind_of: String, default: lazy { default_manage_path })

#migrateBoolean

Run database migrations. This is a bad idea for real apps. Please do not use it.

Returns:

  • (Boolean)


117
# File 'lib/poise_application_python/resources/django.rb', line 117

attribute(:migrate, equal_to: [true, false], default: false)

#ownerString

Owner for the Django application, defaults to application owner.

Returns:

  • (String)


126
# File 'lib/poise_application_python/resources/django.rb', line 126

attribute(:owner, kind_of: String, default: lazy { parent && parent.owner })

#secret_keyString, false

Value for SECRET_KEY in the Django settings. If unset, no key is added to the local settings.

Returns:

  • (String, false)


131
# File 'lib/poise_application_python/resources/django.rb', line 131

attribute(:secret_key, kind_of: [String, FalseClass])

#settings_moduleBoolean

Django settings module in dotted notation. Set to false to disable anything related to settings. Defaults to scanning for the nearest settings.py to #path.

Returns:

  • (Boolean)


137
# File 'lib/poise_application_python/resources/django.rb', line 137

attribute(:settings_module, kind_of: [String, NilClass, FalseClass], default: lazy { default_settings_module })

#syncdbBoolean

Run database sync. This is a bad idea for real apps. Please do not use it.

Returns:

  • (Boolean)


142
# File 'lib/poise_application_python/resources/django.rb', line 142

attribute(:syncdb, equal_to: [true, false], default: false)

#wsgi_moduleBoolean

WSGI application module in dotted notation. Set to false to disable anything related to WSGI. Defaults to scanning for the nearest wsgi.py to #path.

Returns:

  • (Boolean)


148
# File 'lib/poise_application_python/resources/django.rb', line 148

attribute(:wsgi_module, kind_of: [String, NilClass, FalseClass], default: lazy { default_wsgi_module })