Hello, I'm very sorry for the delay.
First, thank you for being interested in python-inject. I hope it will be
a pleasure for you to use it.
I recommend to use the second version of python-inject. It has not been
released only because I haven't updated the documentation, yet it is
stable and is extensively used in my projects and my colleagues' projects.
You can get it from github from the v2.0-providers branch:
You can find a working django example in the examples directory.
>>> Where can I setup my Injector configuration in a Django
project for subsequent dependency injection into my views?
I prefer to setup it in a special file bindings.py which is imported
at the end of settings.py.
I'm sorry but I do not understand why you need to get a controller
from the injector. Yet, you'd bettor not import the injector instance
from anywhere, you should the inject.get_instance method.
import inject
class MyView(View):
def get(self, request, controller_name):
controller_instance = inject.get_instance(controller_name)
return HttpResponse(controller_instance.view())
The request scope is used to store instances specific to each
request. DjangoInjectMiddleware creates a thread-local
dictionary to store instances at the start of a request,
and deletes it at the end.
I recommend you to look at the provided django and simple
examples in the source code.
Sincerely yours, Ivan Korobkov