mysociety / yournextrepresentative

A website for crowd-sourcing structured election candidate data
https://candidates.democracyclub.org.uk/
GNU Affero General Public License v3.0
56 stars 21 forks source link

Allow specifying email settings in general.yml #890

Open wfdd opened 8 years ago

wfdd commented 8 years ago

Is this perhaps what local_settings.py is intended for? Still, few people are gonna be able to run their own SMTP server.

Incidentally, I don't understand why the local settings module is read as a file and executed. Wouldn't something like this work just as well?

try:
    from .local_settings import *
except ImportError:
    pass
dracos commented 8 years ago

I think given the setup of this repo's settings currently, you would probably want email settings in general.yml, with local_settings for development and non-configuration based changes for example, though there's no reason that has to be the case.

You don't have to run your own SMTP server, though, you could add the relevant settings to use your ISP's SMTP server (or your mail user's e.g. gmail has an SMTP server you can use).

As per the comment above the import, the code setup is so local_settings.py can amend existing settings rather than only being able to overwrite them (ie. you could add to a list-based setting without having to replicate/know its existing contents).

wfdd commented 8 years ago

with local_settings for development and non-configuration based changes for example, though there's no reason that has to be the case

That sounds like a pretty roundabout way to set up a development environment. If we're gonna create a new configuration file anyway, why not use the 'settings module' env var?

You don't have to run your own SMTP server, though, you could add the relevant settings to use your ISP's SMTP server (or your mail user's e.g. gmail has an SMTP server you can use).

Well, I have done; I was alluding to the default server setting being localhost, which can't be overridden in the YAML file.

As per the comment above the import ...

I'm invoking the lateness of the hour :) Thanks for explaining.