public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH] pglister: Add possibility to override settings.py in settings_local.py
5+ messages / 2 participants
[nested] [flat]

* [PATCH] pglister: Add possibility to override settings.py in settings_local.py
@ 2021-10-27 15:02  Célestin Matte <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Célestin Matte @ 2021-10-27 15:02 UTC (permalink / raw)
  To: PostgreSQL WWW <[email protected]>

Following the model of pgweb and pgarchives

-- 
Célestin Matte

Attachments:

  [text/x-patch] 0001-Add-possibility-to-override-settings.py-in-settings_.patch (1.3K, 2-0001-Add-possibility-to-override-settings.py-in-settings_.patch)
  download | inline diff:
From c1c08dca0117724a78a642f44ec64a2cc9e9e78c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <[email protected]>
Date: Wed, 27 Oct 2021 16:58:05 +0200
Subject: [PATCH] Add possibility to override settings.py in settings_local.py

Following the model of pgweb and pgarchives
---
 .gitignore               | 1 +
 setup.cfg                | 2 +-
 web/pglister/settings.py | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 8e29657..788789f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *.pyc
 /pglister.ini
 .idea
+web/pglister/settings_local.py
diff --git a/setup.cfg b/setup.cfg
index af55e73..af3c0c8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [pycodestyle]
 statistics=True
 ignore=E402,E501,E741,W504
-exclude=web/dep,web/pglister/auth.py
+exclude=web/dep,web/pglister/auth.py,web/pglister/settings_local.py
 max-line-length=120
diff --git a/web/pglister/settings.py b/web/pglister/settings.py
index ba69207..efa34ea 100644
--- a/web/pglister/settings.py
+++ b/web/pglister/settings.py
@@ -149,3 +149,6 @@ if EXIM_INTEGRATION:
 if DEBUG and DEBUG_TOOLBAR:
     MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
     INSTALLED_APPS.append('debug_toolbar')
+
+# Load local settings overrides
+from .settings_local import *
-- 
2.33.1



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] pglister: Add possibility to override settings.py in settings_local.py
@ 2021-10-31 15:27  Magnus Hagander <[email protected]>
  parent: Célestin Matte <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Magnus Hagander @ 2021-10-31 15:27 UTC (permalink / raw)
  To: Célestin Matte <[email protected]>; +Cc: PostgreSQL WWW <[email protected]>

On Wed, Oct 27, 2021 at 4:02 PM Célestin Matte <[email protected]>
wrote:

> Following the model of pgweb and pgarchives
>

Hi!

local_settings.py is already ignored in web/pglister/.gitignore -- does
that not work for some reason? It works fine from here.

Second, I'm not sure why we want to exclude local_settings.py from
pycodestyle in general?

And finally, settings.py already contains:
try:
    from .local_settings import *
except ImportError:
    pass


Just a couple of lines above where you are adding it back again. Is that
also for some reason not working?

And it is important that it is included before we do the exim part for
example -- otherwise you cannot control that from within local_settings.py.

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ <http://www.hagander.net/;
 Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] pglister: Add possibility to override settings.py in settings_local.py
@ 2021-10-31 18:02  Célestin Matte <[email protected]>
  parent: Magnus Hagander <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Célestin Matte @ 2021-10-31 18:02 UTC (permalink / raw)
  To: Magnus Hagander <[email protected]>; +Cc: PostgreSQL WWW <[email protected]>

Hello,

> 
> And finally, settings.py already contains:
> try:
>     from .local_settings import *
> except ImportError:
>     pass
> 
> 
> Just a couple of lines above where you are adding it back again. Is that also for some reason not working?

Right, I missed that. It's just that in pgweb and pgarchives, the file is called settings_local.py, whereas pglister calls it local_settings.py. This is just a question of naming consistency, then. Do you think it's worth patching?

> Second, I'm not sure why we want to exclude local_settings.py from pycodestyle in general?

It's ignored in pgweb, I just assumed there was a good reason for that and did the same thing for consistency.

Cheers,
-- 
Célestin Matte





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] pglister: Add possibility to override settings.py in settings_local.py
@ 2021-11-04 10:24  Magnus Hagander <[email protected]>
  parent: Célestin Matte <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Magnus Hagander @ 2021-11-04 10:24 UTC (permalink / raw)
  To: Célestin Matte <[email protected]>; +Cc: PostgreSQL WWW <[email protected]>

On Sun, Oct 31, 2021 at 7:02 PM Célestin Matte <[email protected]>
wrote:

> Hello,
>
> >
> > And finally, settings.py already contains:
> > try:
> >     from .local_settings import *
> > except ImportError:
> >     pass
> >
> >
> > Just a couple of lines above where you are adding it back again. Is that
> also for some reason not working?
>
> Right, I missed that. It's just that in pgweb and pgarchives, the file is
> called settings_local.py, whereas pglister calls it local_settings.py. This
> is just a question of naming consistency, then. Do you think it's worth
> patching?
>

If anything, we'd want to move to local_settings.py in that case -- the
reason we switched to doing that in a bunch of the other projects is TBH
something as simple as "then tab completion works better".

In general we've said it's not worth breaking compat for it on the old
repos though. That can obviously be argued. But if we do, we definitely
don't want to do *both*, in that case we should remove them.



> > Second, I'm not sure why we want to exclude local_settings.py from
> pycodestyle in general?
>
> It's ignored in pgweb, I just assumed there was a good reason for that and
> did the same thing for consistency.
>

Oh, I wasn't even aware of that. TBH, I'm not sure that's intentional, that
may be a leak from "it was easiest to do that in the beginning".

I don't really see a reason why we wouldn't want that file to be scanned as
well -- do you?

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ <http://www.hagander.net/;
 Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] pglister: Add possibility to override settings.py in settings_local.py
@ 2021-11-04 15:22  Célestin Matte <[email protected]>
  parent: Magnus Hagander <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Célestin Matte @ 2021-11-04 15:22 UTC (permalink / raw)
  To: Magnus Hagander <[email protected]>; +Cc: PostgreSQL WWW <[email protected]>


> If anything, we'd want to move to local_settings.py in that case -- the reason we switched to doing that in a bunch of the other projects is TBH something as simple as "then tab completion works better".
> 
> In general we've said it's not worth breaking compat for it on the old repos though. That can obviously be argued. But if we do, we definitely don't want to do *both*, in that case we should remove them.

Hrm, so what's your decision on this?

> I don't really see a reason why we wouldn't want that file to be scanned as well -- do you? 

I guess there is no real point scanning a file for proper style if it's not going to get committed

-- 
Célestin Matte






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-11-04 15:22 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 15:02 [PATCH] pglister: Add possibility to override settings.py in settings_local.py Célestin Matte <[email protected]>
2021-10-31 15:27 ` Magnus Hagander <[email protected]>
2021-10-31 18:02   ` Célestin Matte <[email protected]>
2021-11-04 10:24     ` Magnus Hagander <[email protected]>
2021-11-04 15:22       ` Célestin Matte <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox