Need help fixing application_python to work with Django 1.4+


Hi –

I needed to get the application_python cookbook working with a recent
version of Django, which uses a different layout than what is supported
by application_python.

I forked it and made a few changes that should make it do what I
want. Unfortunately, I’ve run into an error I don’t understand. I
basically tried to create a string value “django_project” that could be
set in the django block, similar to collectstatic.

So, in application_python/resource I added
attribute :django_project, :kind_of => [TrueClass, FalseClass, String],
:default => nil
In application_python/providers I referenced it similarly to the way
collectstatic is referenced, new_resource.django_project

I thought that was all I’d have to do, but I now find that it throws an
exception because it can’t find the django_proj method. This is
probably obvious to some of you but… where do I define django_proj as
a method?

Need some help here!

django do
requirements "config/requirements.txt"
django_proj "bartrendr"
settings_template ""
debug app_node[:debug]
collectstatic true
settings django_settings
database do
host mongo_host
database mongo_db_name
mongo_replicaset mongo_replicaset
mongo_replicaset_name mongo_replicaset_name
username "mongo_user"
password "mongo_password"

Recipe Compile Error in



undefined method `django_proj’ for Chef::Resource::ApplicationPythonDjango

Cookbook Trace:

method_missing' /srv/chef/file_store/cookbooks/bti_api/recipes/default.rb:69:inblock (2 levels) in from_file’

`block in method_missing’


method_missing' /srv/chef/file_store/cookbooks/bti_api/recipes/default.rb:67:inblock in from_file’

Relevant File Content:


65: @restart_command
66: end
68: def method_missing(name, *args)
69: if application.respond_to? name
70: application.send(name, *args)
71: else
72>> super
73: end
74: end
76: class OptionsBlock
77: include Chef::Resource::Application::OptionsCollector
78: end
80: def options_block(options=nil, &block)
81: options ||= {}

[2013-06-10T23:42:59+00:00] ERROR: Running exception handlers
[2013-06-10T23:42:59+00:00] FATAL: Saving node information to
[2013-06-10T23:42:59+00:00] ERROR: Exception handlers complete
[2013-06-10T23:42:59+00:00] FATAL: Stacktrace dumped to
[2013-06-10T23:42:59+00:00] FATAL: NoMethodError: undefined method
`django_proj’ for Chef::Resource::ApplicationPythonDjango

Liam Kirsher