config.yml not read prior to DATABASES config in base.py
Hi,
I'm having issues with config.yml. I have just upgraded my 3.1.9 Pip installation on Python2.7.15rc1, and my config.yml is:
MAYAN_ALLOWED_HOSTS: ["*"]
MAYAN_CELERY_RESULT_BACKEND: redis://127.0.0.1:6379/0
MAYAN_BROKER_URL: redis://127.0.0.1:6379/0
PYTHONPATH: /opt/mayan-edms/lib/python2.7/site-packages
MAYAN_MEDIA_ROOT: /opt/mayan-edms/media
MAYAN_DATABASE_ENGINE: django.db.backends.postgresql
MAYAN_DATABASE_HOST: 127.0.0.1
MAYAN_DATABASE_NAME: mayan
MAYAN_DATABASE_PASSWORD: my_password
MAYAN_DATABASE_USER: mayan
MAYAN_DATABASE_CONN_MAX_AGE: 60
DJANGO_SETTINGS_MODULE: mayan.settings.production
When running mayan-edms.py, I get:
(mayan-edms) mayan@odroid /o/mayan-edms> mayan-edms.py
Traceback (most recent call last):
File "/opt/mayan-edms/bin/mayan-edms.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 308, in execute
settings.INSTALLED_APPS
File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/opt/mayan-edms/local/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/opt/mayan-edms/local/lib/python2.7/site-packages/mayan/settings/__init__.py", line 3, in <module>
from .base import * # NOQA
File "/opt/mayan-edms/local/lib/python2.7/site-packages/mayan/settings/base.py", line 336, in <module>
'NAME': os.environ['MAYAN_DATABASE_NAME'],
File "/opt/mayan-edms/lib/python2.7/UserDict.py", line 40, in __getitem__
raise KeyError(key)
KeyError: u'MAYAN_DATABASE_NAME'
Which seems to indicate that MAYAN_DATABASE_NAME is not loaded yet at line 336 in https://gitlab.com/mayan-edms/mayan-edms/blob/master/mayan/settings/base.py#L336
And indeed, it seems to be read only at https://gitlab.com/mayan-edms/mayan-edms/blob/master/mayan/settings/base.py#L358
That raises a few questions:
- Am i misinterpreting what's happening (i.e. is config.yml imported elsewhere, prior to the database setting)?
- Is my config.yml configure correctly? https://docs.mayan-edms.com/topics/settings.html#via-yaml-configuration-file isn't very helpful.
- Is there something wrong with base.py?
Thank you.
Edited by Michel Lavoie