Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of messed settings and urls #21

Merged
merged 1 commit into from
Sep 14, 2017
Merged

Cleanup of messed settings and urls #21

merged 1 commit into from
Sep 14, 2017

Conversation

cezio
Copy link
Contributor

@cezio cezio commented Jun 30, 2017

There was a bit of mess in master branch:

  • project_name.settings were duplicating whole geonode.settings,
  • additionally, project_name.local_settings were added, they didn't include sibling settings, just geonode.settings.
  • urls.py were duplicated from geonode.urls in whole.
  • celeryapp was added (which is rare case of need), would mask geonode's celery tasks.

This PR cleans it:

  • removed local_settings.py from repo, but added local_settings.py.sample, so users can use it for deployment,
  • streamlined settings.py, so they customize only actually relevant settings by default,
  • removed celeryapp.py.
  • updated documentation about settings chaining.

@afabiani
Copy link
Member

@simod @jj0hns0n @pjdufour @capooti this PR wants to clean-up settings/loca_settings mess on geonode-project master.

It basically gets rid of duplicated settings from geonode and ships with a minimal set of settings (getting rid also of {{project}}.local_settings which are not needed anymore).

Don't know exactly how this stuff has been messed up, but now should be clean again.

Can you please review and merge?

@jj0hns0n
Copy link
Member

@kalxas you are the one who should really look at this.

@capooti
Copy link
Member

capooti commented Jun 30, 2017

thanks for taking care of this @cezio.
It is great to have more documentation and less entropy here finally :)
One small note: I think we are discouraging the local_settings.py approach vs the use of environment variables.
Thanks again!

@pjdufour
Copy link
Member

pjdufour commented Jun 30, 2017 via email

@ingenieroariel
Copy link
Member

ingenieroariel commented Jul 2, 2017 via email

@simod
Copy link
Member

simod commented Jul 2, 2017 via email

@afabiani
Copy link
Member

afabiani commented Jul 3, 2017

@pjdufour this PR does what you mentioned (as far as I understood).

Now we have only minimal {{project}}.settings which inherits from geonode.settings

Basically this is a basic, clean structure for {{project}}. It is always possible to have our own {{project}}.local_settings (even if I would suggest to take just one settings}. It is matter of changing the {{project}}.wsgi reference.

@cezio
Copy link
Contributor Author

cezio commented Jul 3, 2017

NOT having "geonode.settings import *" in .setting was by
design and not an error, so to avoid circular imports, etc. Didn't we just
have a thread about this last week or something?

I'm not aware of such discussion. Could you point me to some archives?

But anyway, approach introduced in master seems to be wrong for several reasons:

  • this is code duplication of core element, which is bad in itself. Geonode's settings contain many entries that are geonode-specific, and usually they are good defaults (unless one knows what's doing, no point to change it). The same goes to urls. This stuff is usually too sensitive to change whole file 'just because'.
  • I believe most common usage scenario for geonode-project is to have customized html templates, and introduce additional functionalities. In this case, there's no point to duplicate good defaults to geonode-project, only things that are really needs to be changed to have deployment working for user without much of fuss. Bigger customizations require more work, geonode-project won't be helpful then anyway.
  • It is common practice to have base settings and deployment-specific settings that import base and change just few things. Using geonode.settings as a base is also more future-proof than having settings duplicated to geonode_project.settings and using that as a base. Geonode's settings change between versions, user would change geonode's required version, ending up with old, potentially broken settings. No need to make things harder than they should be, really.
  • Apart from practical inconvenience of specifying env variables to run django app, using environment variables in settings is not very wise, when you operate with complex data structures. With env variable you can pass a string, but not dictionary or a list. I don't think things like
    INSTALLED_APPS = os.getenv('INSTALLED_APPS',_DEFAULT_INSTALLED_APPS)
    would ever work with env var. Also, from devops perspective: Django provides configuration mechanism already with a separate settings file. No need to reinvent the wheel here with os.environ.

@ingenieroariel
Copy link
Member

ingenieroariel commented Jul 3, 2017 via email

@kalxas
Copy link
Member

kalxas commented Jul 4, 2017

+1 to have a dev call about this.
@cezio the discussion you are missing is here:
#18

@rob-metalinkage
Copy link

Hi
am writing additional modules for a downstream geonode project - to add a layer of semantic enablement, but these are in fact standalone django modules that have already been deployed against geonode installs. I'd like to have a clear instruction to developers of add-on functions about how to present module-specific defaults and customisation options into a django parent project in general and geonode specifically.
Happy to discuss, review proposals and be a guinea pig to test such ideas out.

@cezio
Copy link
Contributor Author

cezio commented Sep 13, 2017

@rob-metalinkage if this what you're writing is just Django app, this can be plain package (proper setup.py + app code). No need to use geonode-project here, especially if you don't customize base templates.

For module-specific defaults and settings, check https://django-appconf.readthedocs.io/en/latest/

@rob-metalinkage
Copy link

each package has setup, and can be installed into python environment and manually configured into any django project. AFAICT this doesnt however address the issue of settings required for a module, installing other components a module might need to communicate with, or running tests against modules. hacking the geonode (or other master project) settings and urls seems to be the only option.
(IMHO the way migrations are picked up for each module should be extended to settings templates and tests - maybe I'm missing something but havent been able to find anything about this)

@afabiani
Copy link
Member

@ALL latest agreements have been reflected on this PR

#24

please find also Hangout discussion minutes here

https://goo.gl/cGHznN

@simod simod merged commit 1956c2c into GeoNode:master Sep 14, 2017
@afabiani
Copy link
Member

@simod you merged the wrong one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants