Verify wsgi.py copy before reloading the webapp - #23
Merged
Conversation
Consoles are reused across API calls, so a relative cp source path can silently copy from the wrong cwd, and run_command never checked exit status at all. Either failure mode left the deploy reporting success while PythonAnywhere kept serving its placeholder wsgi app. The destination filename also needs a lowercased username: PythonAnywhere only looks for the lowercased form regardless of the account's actual casing.
copelco
approved these changes
Aug 27, 2026
| non-zero status. | ||
| """ | ||
| response = self.send_input(f"{command}\n") | ||
| full_command = f'{command}; echo "{self.EXIT_STATUS_MARKER}:$?"' |
Member
There was a problem hiding this comment.
Cool!
15:06 ~ $ curl -fsSL https://raw.githubusercontent.com/caktus/dsd-pythonanywhere/refs/heads/main/scripts/setup.sh | bash -s -- https://github.com/copelco/dsd-testproj.git dsd-testproj blo
g; echo "DSD_EXIT_STATUS:$?"
Cloning repository...
Cloning into 'dsd-testproj'...
--snip--
127 static files copied to '/home/copelcobeginner/dsd-testproj/static'.
Setup complete!!!
DSD_EXIT_STATUS:0
15:09 ~ $| # cp can "succeed" while copying the wrong file (e.g. an unexpected | ||
| # cwd), so confirm the destination actually matches the source before | ||
| # declaring the deploy successful. | ||
| verify_cmd = f"cmp -s {wsgi_src} {wsgi_dest} && echo COPY_VERIFIED || echo COPY_FAILED" |
Member
There was a problem hiding this comment.
Nice-- worked for me!
15:32 ~ $ cmp -s /home/copelcobeginner/dsd-testproj/blog/wsgi.py /var/www/copelcobeginner_pythonanywhere_com_wsgi.py && echo COPY_VERIFIED || echo COPY_FAILED; echo "DSD_EXIT_STATUS:$?"
COPY_VERIFIED
DSD_EXIT_STATUS:0
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.
Consoles are reused across API calls, so a relative cp source path can silently copy from the wrong cwd, and run_command never checked exit status at all. Either failure mode left the deploy reporting success while PythonAnywhere kept serving its placeholder wsgi app. The destination filename also needs a lowercased username: PythonAnywhere only looks for the lowercased form regardless of the account's actual casing.
Fixes #21
This fix was generated with Claude (Sonnet if that matters)