django-lightweight-queue
django-lightweight-queue copied to clipboard
Expand Settings to handle different Django Architectures
Expanding from https://github.com/thread/django-lightweight-queue/pull/61
The settings for django-lightweight-queue expect and require that all settings are laid out in a single file and are all ready at runtime, which is not an accurate assumption for projects that use environment variables to determine which settings to load at runtime. This PR refactors the internal project settings to be similar to that of django-cors-headers, though this one is more complex because django-lightweight-queue expects to be able to rewrite every setting on its own.
This is a stacked PR with https://github.com/thread/django-lightweight-queue/pull/64 and this one should be merged first.
@PeterJCLaw I've refactored it to flesh out your suggestion, but I'm a little concerned that the readability has gone down. (Very pleased about the decrease in length, though.) Ready for review again.
Re: type checking: I admit that I have no idea how to properly pass the type hints through that __getattr__ call -- we passed the limit of my skills appeasing mypy long ago in this process. I'm open to trying whatever, but if you have an idea how to make it work then would you be open to implementing it? At this point I've spent about as much time fighting mypy errors as I have actually writing code and it's quite frustrating.
Re: type checking: I admit that I have no idea how to properly pass the type hints through that
__getattr__call -- we passed the limit of my skills appeasing mypy long ago in this process. I'm open to trying whatever, but if you have an idea how to make it work then would you be open to implementing it? At this point I've spent about as much time fighting mypy errors as I have actually writing code and it's quite frustrating.
Sure, I'm happy to have a go at this. I realise that mypy errors can be a little obtuse at times! Thanks for your efforts getting us this far :)
Quick update -- I haven't forgotten this, just haven't had time recently.
Thanks for building this & sorry it's taken so long to reach a conclusion here. We've ended up extending this in #70 which I've now merged. Hopefully that resolves the use-cases you had in mind.