Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow to set path to INI file in the WSGI script#5987

Merged
amercader merged 1 commit into
masterfrom
wsgi-file-config
May 4, 2021
Merged

Allow to set path to INI file in the WSGI script#5987
amercader merged 1 commit into
masterfrom
wsgi-file-config

Conversation

@amercader
Copy link
Copy Markdown
Member

The wsgi script that we include as example to be used with uwsgi or gunicorn expects a ckan.ini file in the same folder. This adds support for the CKAN_INI env var which is already supported when running the CLI.

Features:

  • includes bugfix for possible backport

The wsgi script that we include as example to be used with uwsgi or
gunicorn expects a `ckan.ini` file in the same folder. This adds support
for the `CKAN_INI` env var which is already supported when running the
CLI.
@kowh-ai
Copy link
Copy Markdown
Contributor

kowh-ai commented Mar 26, 2021

@amercader - This change seems to work OK when I run /usr/lib/ckan/default/bin/uwsgi -i /etc/ckan/default/ckan-uwsgi.ini after setting the CKAN_INI environment to "somewhere else"...and in my case /tmp/ckan.ini. However it then has a problem trying to find who.ini in /tmp which I presume is fine (and expected). I'm just wondering if the uwsgi server is started via supervisor, the CKAN_INI environment variable would need to be included (somehow) in the shell running the command...Perhaps this should be included in the documentation somewhere also

Copy link
Copy Markdown
Contributor

@kowh-ai kowh-ai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to go!

@amercader
Copy link
Copy Markdown
Member Author

Thanks @kowh-ai

However it then has a problem trying to find who.ini in /tmp which I presume is fine (and expected).

The path to who.ini is defined using %(here)s by default so you need to move the who.ini next to the ckan.ini file location or modify the path in the ini file

if the uwsgi server is started via supervisor, the CKAN_INI environment variable would need to be included

If you need to pass an env var to the supervisor process you can do so using the environment supervisor setting.

environment=CKAN_INI=/etc/ckan/ckan.ini

We can definitely add this to the deploy docs

@amercader amercader merged commit eb56819 into master May 4, 2021
@amercader amercader deleted the wsgi-file-config branch May 4, 2021 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants