Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected SystemSettings interaction causing failure to run via wsgi.py #11660

Open
jacobtylerwalls opened this issue Nov 27, 2024 · 1 comment
Labels
Priority: High Type: Bug Something isn't working

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Nov 27, 2024

@ekansa reported on the forum a failure to run an arches project via wsgi.py, i.e. not run with runserver. The TL;DR is that we have the default value of APP_NAME being stored in a system settings tile and overriding the project settings file, only under wsgi.py.

Traced it to this unexpectedly evaluating True:

if settings.APP_NAME == "Arches":

... because wsgi.py loads system settings from the database:

settings.update_from_db()

... and we save the value "Arches" for APP_NAME in the database during setup_db, which is going to be incorrect for all cases (only applies to running "naked" core arches like a project):

"en":{
"direction":"ltr",
"value":"Arches"
}

management.call_command(
"packages", operation="import_graphs", source=settings_graph
)


@chrabyrd and I didn't notice this when developing f569e09 and related features because we were running the devserver, but arguably this is an orthogonal bug.

We have other cases where we need the value of APP_NAME to be correct:

if settings.APP_NAME == "Arches":
base_path = root_dir_path


I reproduced on 7.6.3 with Eric's instructions:

  • clone opencontext/arches-via-docker
  • checkout the 'local' branch
  • cp edit_dot_env .env
  • make DEBUG=False (in .env) and also change the SHOW_LANGUAGE_SWITCH to be True
  • commented out DEPLOY_HOST in settings_local since there wasn't a fallback
  • prepend npm i [email protected] to the build development command to work around vue-tsc not work with typescript 5.7.2 vuejs/language-tools#5018. (This will hopefully disappear in a few days.)
  • visit the server at 0.0.0.0:8004

Next steps

A workaround is to comment out the last line of wsgi.py that calls update_from_db(), or updating the invalid tile value in pg directly. But regardless of the wisdom of that, there a few things to look into, some of which shouldn't be done in a patch?

  • fix the values in these tiles (migration? in v8?)
  • update the python SystemSettings to ignore this node (can do in a patch)
  • stop creating values in these tiles (in v8?)

cc/ @aarongundel

@jacobtylerwalls jacobtylerwalls added Type: Bug Something isn't working Priority: High labels Nov 27, 2024
@jacobtylerwalls jacobtylerwalls changed the title Unexpected system_settings interaction causing failure to run WSGI application Unexpected SystemSettings interaction causing failure to run WSGI application Nov 27, 2024
@chiatt chiatt added this to pipeline Nov 27, 2024
@jacobtylerwalls jacobtylerwalls changed the title Unexpected SystemSettings interaction causing failure to run WSGI application Unexpected SystemSettings interaction causing failure to run via wsgi.py Nov 27, 2024
@ekansa
Copy link

ekansa commented Nov 27, 2024

@jacobtylerwalls thanks for the deep investigation and diagnosis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High Type: Bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants