Usually I use buildout for my django projects, which builds complete environment to run project.
One of environment parts is uwsgi application container server, for installing which i use shaunsephton.recipe.uwsgi(to be honest, i use self-patched version of this recipe, but it's other story).
Recently, when I tried to rebuild my project, I was surprise on building uwsgi part:
original exception was skipped
...
File "/package/develop/recipes/uwsgi/shaunsephton/recipe/uwsgi.py", line 93, in build_uwsgi
uwsgiconfig.parse_vars()
AttributeError: 'module' object has no attribute 'parse_vars'
...
As we see, the problem is in call of non-existent attribute(method) parse_vars of uwsgiconfig module.
After few minutes groundless looking in sources, i recall that this buildout recipe always get latest uwsgi version to build it. No doubt, this method was refactored in 'new' latest tarball, so the exception was raised in cause of backward incompatible changes.
To find out what exactly was changed, and see how to use it now i had to find changeset that made uwsgiconfig.py incompatible, so i went to uwsgi trac site and lurked in http://projects.unbit.it/uwsgi/log/uwsgiconfig.py and found changeset
where uwsgiconfig.parse_vars was removed.
When we know how to use new code we can solve recipe problem in this part :
uwsgiconfig = __import__('uwsgiconfig')
uwsgiconfig.parse_vars()
uwsgiconfig.build_uwsgi('uwsgi')
To fix this, and be compatible with older versions(if you want be able to build older versions), i had to replace that piece of code with this:
uwsgiconfig = __import__('uwsgiconfig')
try:
uwsgiconfig.parse_vars()
uwsgiconfig.build_uwsgi('uwsgi')
except AttributeError:
uwsgiconfig.build_uwsgi(uwsgiconfig.uConf('buildconf/default.ini'))
No comments:
Post a Comment