# Need help fixing application\_python to work with Django 1.4+

**URL:** <https://discourse.chef.io/t/need-help-fixing-application-python-to-work-with-django-1-4/4065>\
**Category:** Chef Infra (archive)\
**Created:** [June 10, 2013, 11:57pm UTC](https://discourse.chef.io/t/need-help-fixing-application-python-to-work-with-django-1-4/4065 "2013-06-10T23:57:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam\_Kirsher](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/liam_kirsher/32/279_2.png) [@Liam\_Kirsher](https://discourse.chef.io/u/Liam_Kirsher)\
**Post date:** [June 10, 2013, 11:57pm UTC](https://discourse.chef.io/t/need-help-fixing-application-python-to-work-with-django-1-4/4065/1 "2013-06-10T23:57:37Z")

</div>

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 "settings.py.erb"  
> > 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"  
> > end

> Recipe Compile Error in  
> /srv/chef/file\_store/cookbooks/bti\_api/recipes/default.rb
> 
> ================================================================================
> 
> NoMethodError
> 
> * * *
> 
> undefined method `django\_proj' for Chef::Resource::ApplicationPythonDjango
> 
> ## Cookbook Trace:
> 
> /srv/chef/file\_store/cookbooks/application/libraries/default.rb:72:in  
> `method_missing' /srv/chef/file_store/cookbooks/bti_api/recipes/default.rb:69:in `block (2 levels) in from\_file'
> 
> /srv/chef/file\_store/cookbooks/application/resources/default.rb:115:in  
> `block in method\_missing'
> 
> /srv/chef/file\_store/cookbooks/application/resources/default.rb:112:in  
> `each'
> 
> /srv/chef/file\_store/cookbooks/application/resources/default.rb:112:in  
> `method_missing' /srv/chef/file_store/cookbooks/bti_api/recipes/default.rb:67:in `block in from\_file'  
> /srv/chef/file\_store/cookbooks/bti\_api/recipes/default.rb:44:in  
> `from\_file'
> 
> ## Relevant File Content:
> 
> /srv/chef/file\_store/cookbooks/application/libraries/default.rb:
> 
> 65: @restart\_command  
> 66: end  
> 67:  
> 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  
> 75:  
> 76: class OptionsBlock  
> 77: include Chef::Resource::Application::OptionsCollector  
> 78: end  
> 79:  
> 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  
> /srv/chef/file\_store/failed-run-data.json  
> [2013-06-10T23:42:59+00:00] ERROR: Exception handlers complete  
> [2013-06-10T23:42:59+00:00] FATAL: Stacktrace dumped to  
> /srv/chef/file\_store/chef-stacktrace.out  
> [2013-06-10T23:42:59+00:00] FATAL: NoMethodError: undefined method  
> `django\_proj' for Chef::Resource::ApplicationPythonDjango

--  
Liam Kirsher  
PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
