class PoiseApplicationPython::Resources::Django::Provider
Provider
for ‘application_django`.
@since 4.0.0 @see Resource
@provides application_django
Public Instance Methods
action_deploy()
click to toggle source
‘deploy` action for `application_django`. Ensure all configuration files are created and other deploy tasks resolved.
@return [void]
# File lib/poise_application_python/resources/django.rb, line 290 def action_deploy set_state notifying_block do write_config run_syncdb run_migrate run_collectstatic end end
Private Instance Methods
manage_py_execute(*cmd)
click to toggle source
Run a manage.py command using ‘python_execute`.
# File lib/poise_application_python/resources/django.rb, line 340 def manage_py_execute(*cmd) raise PoiseApplicationPython::Error.new("Unable to find a find a manage.py for #{new_resource}, please set manage_path") unless new_resource.manage_path python_execute "manage.py #{cmd.join(' ')}" do python_from_parent new_resource command [::File.expand_path(new_resource.manage_path, new_resource.path)] + cmd cwd new_resource.path environment new_resource.app_state_environment group new_resource.group user new_resource.owner end end
run_collectstatic()
click to toggle source
Run the asset pipeline.
# File lib/poise_application_python/resources/django.rb, line 323 def run_collectstatic manage_py_execute('collectstatic', '--noinput') if new_resource.collectstatic end
run_migrate()
click to toggle source
Create the database using the newer migrate command. This should work for either South or the built-in migrations support.
# File lib/poise_application_python/resources/django.rb, line 318 def run_migrate manage_py_execute('migrate', '--noinput') if new_resource.migrate end
run_syncdb()
click to toggle source
Create the database using the older syncdb command.
# File lib/poise_application_python/resources/django.rb, line 312 def run_syncdb manage_py_execute('syncdb', '--noinput') if new_resource.syncdb end
set_state()
click to toggle source
Set app_state variables for future services et al.
# File lib/poise_application_python/resources/django.rb, line 303 def set_state # Set environment variables for later services. new_resource.app_state_environment[:DJANGO_SETTINGS_MODULE] = new_resource.settings_module if new_resource.settings_module new_resource.app_state_environment[:DATABASE_URL] = new_resource.database[:URL] if new_resource.database[:URL] # Set the app module. new_resource.app_state[:python_wsgi_module] = new_resource.wsgi_module if new_resource.wsgi_module end
write_config()
click to toggle source
Create the local config settings.
# File lib/poise_application_python/resources/django.rb, line 328 def write_config # Allow disabling the local settings. return unless new_resource.local_settings_path file new_resource.local_settings_path do content new_resource.local_settings_content mode '640' owner new_resource.owner group new_resource.group end end