Fix Flask WebAPP paths to be project-root anchored#30
Closed
arvinder004 wants to merge 2 commits intoEAPD-DRB:mainfrom
Closed
Fix Flask WebAPP paths to be project-root anchored#30arvinder004 wants to merge 2 commits intoEAPD-DRB:mainfrom
arvinder004 wants to merge 2 commits intoEAPD-DRB:mainfrom
Conversation
Collaborator
|
Thanks @arvinder004. The project-root anchoring pattern you introduced here has been incorporated into the Closing as superseded. Appreciate the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a bug where the Flask app failed to locate
index.html(and other WebAPP assets) when run from theAPI/directory due to cwd‑dependent paths in bothAPI/app.pyandAPI/Classes/Base/Config.py. All relevant paths are now anchored to the project root usingPROJECT_ROOTandConfig.WebAPP_PATH, making template and static file resolution consistent across environments.Changes
1. Make WebAPP paths project-root anchored in
Config.pyFile:
API/Classes/Base/Config.pyBefore (lines 23–29):
After (lines 23–29):
PROJECT_ROOTbased on__file__, independent of the current working directory.2. Configure Flask to use Config.WebAPP_PATH for templates and static files
File:
API/App.pyBefore:
After:
Config.py.render_template('index.html')correctly resolvesWebAPP/index.htmlregardless of where the app is launched from.Related issues
index.htmldue to cwd‑dependent WebAPP paths #29Checklist