Re: Redis cache support in core

2019-06-27 Thread Josh Smeaton
Markus, I'd prefer that approach over vendoring a more incomplete solution. Bonus points if we can add packages to extra_requires, so that `pip install Django[redis]` would work nicely. On Friday, 21 June 2019 23:17:25 UTC+10, Markus Holtermann wrote: > > Hi all, > > may I suggest that django-r

Discussing improvements of django.setup()

2019-06-27 Thread Pkl
Hello everyone, I'm bringing here, for broader review and discussion, the subject of making django setup more "tweakable": https://code.djangoproject.com/ticket/30536 https://github.com/django/django/pull/11435 There is indeed a need for doing pre/post operations at that crucial moment of the f

Re: Resource loading (Django without a filesystem)

2019-06-27 Thread Peter Baumgartner
Unfortunately you can't load resources from implicit namespace packages. It raises `FileNotFoundError: Package has no location ` The __init__.py appears to be required. On Thu, Jun 27, 2019 at 3:05 PM Andrew Godwin wrote: > > Well, remember that in Python 3 you don't need an __init__.py file to h

Re: [Feature Request][Model, ORM] Disabling a field before removal to support continuous delivery

2019-06-27 Thread Pkl
Just for reference, here is a package I crossed recently and which has an approach for that : https://github.com/3YOURMIND/django-deprecate-fields On Monday, June 24, 2019 at 3:15:04 PM UTC+2, Matthieu Rudelle wrote: > > Hi there, > > I can't find any previous ticket proposing a solution to this

Re: Resource loading (Django without a filesystem)

2019-06-27 Thread Andrew Godwin
Well, remember that in Python 3 you don't need an __init__.py file to have something be a module (because of https://www.python.org/dev/peps/pep-0420/), but I wonder if there still needs to be a proper discovery mechanism that flags that they should be considered as implicit packages/modules. And

Re: Resource loading (Django without a filesystem)

2019-06-27 Thread Peter Baumgartner
The big issue I see is that a resource must reside directly in a Python module. You can not load a resource from a child directory, e.g. I can load "index.html" from the Python module "myproject.templates", but I can't load "app1/index.html" from the same module. This would require developers to s

Re: Resource loading (Django without a filesystem)

2019-06-27 Thread Andrew Godwin
My impression reading over the problem a little yesterday was that we could work to provide a common "get me a resource" abstraction in Django that papers over the couple of different ways it has to work, though I haven't looked super far into things that require directory listing (e.g. migrations)

Re: Resource loading (Django without a filesystem)

2019-06-27 Thread Markus Holtermann
Hi Peter, PyOxidizer looks indeed super interesting. Talking about templates and specifically Jinja2 templates, they are internally converted to the Python AST if I'm not mistaking. Turning them into Python modules that a new Jinja2ModuleTemplateLoader could load doesn't seem like that far fetc

Resource loading (Django without a filesystem)

2019-06-27 Thread Peter Baumgartner
I'm interested in using PyOxidizer [1] to create single-file executable Django projects. This currently isn't possible because of all the places Django assumes it is operating on a proper filesystem. I haven't done a full audit, but templates, migrations, and static files come to mind. Python h

Re: Difficulty setting dynamic 'db_table' in Meta

2019-06-27 Thread Adam Johnson
So it looks to me like migrations feeds off of models.original_attrs: https://github.com/django/django/blob/master/django/db/models/options.py#L160 / https://github.com/django/django/blob/master/django/db/migrations/state.py#L453 This is set at contribute_to_class time in the Meta. The __new__ me