Browse Source

Gunicorn tweaks:

* Fix gunicorn environment variable
* Make 'dev' default application mode
* Print gunicorn configuration on startup
Stefano Cossu 5 years ago
parent
commit
56ddfa1f80
2 changed files with 7 additions and 2 deletions
  1. 1 1
      lakesuperior/etc.defaults/application.yml
  2. 6 1
      lakesuperior/wsgi/__init__.py

+ 1 - 1
lakesuperior/etc.defaults/application.yml

@@ -7,7 +7,7 @@
 #   Set app_mode to either 'prod', 'test' or 'dev'.
 #   'prod' is normal running mode. 'test' is used for running test suites.
 #   'dev' is similar to normal mode but with reload and debug enabled.
-app_mode: 'prod'
+app_mode: 'dev'
 
 ### Base data directory.
 #   This contains both volatile files such as PID files,

+ 6 - 1
lakesuperior/wsgi/__init__.py

@@ -6,6 +6,7 @@ import yaml
 from lakesuperior.config_parser import (
         config as main_config, default_config_dir)
 
+
 __doc__ = """
 GUnicorn WSGI configuration.
 
@@ -71,7 +72,7 @@ class __Defaults:
 
 
 __def = __Defaults()
-__app_mode = __def.config.get('app_mode', __def.app_mode)
+__app_mode = main_config['application'].get('app_mode', __def.app_mode)
 
 # Exposed Gunicorn parameters begin here.
 
@@ -95,3 +96,7 @@ pidfile = os.path.join(__def.run_dir, 'fcrepo.pid')
 accesslog = os.path.join(__def.log_dir, 'gunicorn-access.log')
 errorlog = os.path.join(__def.log_dir, 'gunicorn-error.log')
 
+print('\nLoading WSGI server with configuration:')
+for prop in __all__:
+    print(f'{prop:>16} = {locals().get(prop)}')
+print('\n')