Closed K-dash closed 6 months ago
This is awesome. Good call on centralizing the vars in .env
. it felt redundant to make the config.json
file
Your changes make the code more simple/easy to read. I'm not very familiar with flask(probably obvious lol) or Jinja2, but it looks like the right move.
As for the proposed changes, they make sense to me. I think it would also be useful to create separate files for each kind of test case, like test_api.py', 'test_server.py
, etc. instead of consolidating them all in test_code.py
. Edit: Just saw you proposed this in the test cases issue. Beat me to it!
Looks great, thank you for the detailed writeup. Merging now
@ryansurf Thank you for merging the PR! Also, thank you for accepting the proposal to change the directory structure. I will address this in a separate PR shortly.
The main changes include:
render_template
instead of directly sending theindex.html
file. This enables the use of Jinja2 templating to pass environment variables from Flask to the frontend.index.html
to utilize the passed environment variables using Jinja2 syntax. The variables can now be accessed and used within the HTML file.index.html
to match the Flask project structure. The file has been moved to the appropriate folder (e.g., templates/) to work seamlessly withrender_template
.Refactoring
In this commit, the
query_to_args_list
function and its associated test code, which were added in #14 , have been removed due to the migration to Flask. These are no longer needed.What I'd like to discuss
Moving
index.html
to the templates folder has blurred the boundary between backend and frontend. (With this modification, the frontend folder only containsscript.js
) If we plan to continue using Flask's template engine, I think it would be better to unify the frontend and backend directories as follows.Specifically
backend/frontend
directories and move all the files under them directly under the src directoryfrontend
directory tostatic
Fixes #15