Repository: getpelican/pelican

Issue:
Reload settings file when not specified
Explicitly defining a settings file will be reloaded when using the --autoreload option. Using the default will indicate that the settings file is tracked, but will not reload the file when it is changed.



Discussion:
Looks sensible enough to me. @NathanHarrington did you test the new default value?

Yes, have used this fork for two different sites to ensure the settings file is reloaded. Is that the test you were looking for?

@justinmayer ^

(am I being too pushy with the issues?)

@NathanHarrington: Many thanks for the contribution. Apologies for the long delay in getting this in.

@leotrs: Not pushy at all. On the contrary — it has been quite helpful!

I believe there might be a problem with this. [As noted in our docs](http://docs.getpelican.com/en/stable/faq.html?highlight=mandatory#is-it-mandatory-to-have-a-configuration-file), settings files are not mandatory. But since this change specifies a configuration file even when the user has not, `pelican` invocations now result in `IOError: [Errno2] No such file or directory` if there is no `pelicanconf.py` file present.

@NathanHarrington: Would you be so kind as to look into a resolution to this problem? We use `env LC_ALL=en_US.utf8 pelican -o pelican/tests/output/basic/ samples/content/` to generate functional test output, but that command cannot currently be run due to the aforementioned problem, ostensibly introduced by the changes in 76dcd64.

Yes, I should be able to look at a resolution this week.

Hi Nathan. Any word on a fix for this problem? It's a bit of a blocker, and I'd prefer that we fix it rather than reverting it entirely.  (^_^)

We are very busy getting ready for a trade show. Now it looks like I won't
be able to give this the time it needs this week. Thanks for your patience,
but looks like no fix will be available from me until Oct. 3rd at the
earliest.

On Sep 15, 2016 8:37 AM, "Justin Mayer" notifications@github.com wrote:

> Hi Nathan. Any word on a fix for this problem? It's a bit of a blocker,
> and I'd prefer that we fix it rather than reverting it entirely. (^_^)
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> https://github.com/getpelican/pelican/issues/1966#issuecomment-247316186,
> or mute the thread
> https://github.com/notifications/unsubscribe-auth/ALRl0wLdG_0HASe7Y9EP2s7vNtR6yImSks5qqTwKgaJpZM4Ipx6b
> .


Resolving patch:
diff --git a/pelican/__init__.py b/pelican/__init__.py
--- a/pelican/__init__.py
+++ b/pelican/__init__.py
@@ -277,7 +277,6 @@ def parse_arguments():
                         '"output" in the current path.')
 
     parser.add_argument('-s', '--settings', dest='settings',
-                        default=DEFAULT_CONFIG_NAME,
                         help='The settings of the application, this is '
                         'automatically set to {0} if a file exists with this '
                         'name.'.format(DEFAULT_CONFIG_NAME))
@@ -370,6 +369,7 @@ def get_instance(args):
     config_file = args.settings
     if config_file is None and os.path.isfile(DEFAULT_CONFIG_NAME):
             config_file = DEFAULT_CONFIG_NAME
+            args.settings = DEFAULT_CONFIG_NAME
 
     settings = read_settings(config_file, override=get_config(args))
 


Test patch: