-
Notifications
You must be signed in to change notification settings - Fork 3
Fix flask 3.x compatibility, Debug logging, Astra UV locking, and prevent duplicate File uploads on reload #1
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
Open
WasimTTY
wants to merge
22
commits into
parazyd:master
Choose a base branch
from
WasimTTY:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
* Updated blck.py to flask 3.x * Updated blck.py with logging * Create Dockerfile * Create requirements.txt * Update Dockerfile * Update Dockerfile * build: modify Dockerfile * build:modify Dockerfile * Delete requirements.txt * build: updated Dockerfile * Create requirements.in * Rename requirements.in to requirements.txt * Update Dockerfile * Update Dockerfile * Update and rename requirements.txt to requirements.in * Create requirements.txt * Create install_OS-dependencies.sh * modify install_OS-dependencies.sh * Update install_OS-dependencies.sh * added pyproject.toml & uv.lock files via uv init * build:modify Dockerfile * Update pyproject.toml * Delete install_OS-dependencies.sh * modify:build Dockerfile * modify:pyproject.toml * generated requirements.txt * modify:uv.lock * created .dockerignore * Delete requirements.in * modify: build Dockerfile * Update Dockerfile --------- Co-authored-by: root <root@ip-172-31-93-252.ec2.internal> Co-authored-by: root <root@ip-172-31-26-242.ec2.internal>
…icorn as WSGI server
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.
This pull request addresses compatibility issues with the original code, introduces logging based on the -d flag for debug mode, ensures the application’s dependencies are locked using Astra UV for more stable and reproducible deployments, and fixes an issue where reloading the page caused the form to be resubmitted, leading to duplicate files. Uses gunicorn as WSGI server instead of bjoern which required os-level dependencies to be installed as a prerequisite.
Key changes:
1. Flask version compatibility
The original code used safe_join from Flask, which is not available in Flask 3.x. The safe_join function has been moved to werkzeug.utils starting from Flask 2.2.x and onwards.
2. Logging setup
3. Fix for Duplicate File Upload on Page Reload
After a successful upload, a file URL gets displayed and when the reload button on the browser is clicked, it triggers a form submission which results in the same file getting submitted multiple times resulting in duplicate (same file different URLs).
The below image is a fix for preventing the resubmission of form.
Clicking refresh on the browser no longer triggers the resubmission of the form.
Testing
1. Local testing:
2. Production testing:
When deployed using gunicorn, the WSGI server handles the logging and the logs will be written to file.
The access logs will be written to access.log file and the error logs will be written to error.log file.
The below image represents the access.log
4. Astra UV dependency locking: