Replies: 2 comments
-
|
Thanks for all of that, Adrian. Paths are always tricky. Note that the code for Chapter 7 declares FOLDER and CHARTS like so: and this is discussed on page 307 in the book (albeit towards the end of Chapter 6). As these paths are relative, the requirement to change them should not be necessary whether running locally or on PythonAnywhere (see the instructions on page 339 in Chapter 7 on how to set the default paths on PythonAnywhere). And, yes, that's a bug for your point #2... the .DS_Store file isn't an issue on a Mac, but is everywhere else so my code is a little naive and should really protect that line of code with either a try...except... block or the code which you have provided. Thanks for raising this with me. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the nudge and the page refs. You’re right, the relative CHARTS/FOLDER paths should work fine as long as the PythonAnywhere working dir is set correctly. In my case I’d hard‑coded my local paths before upload, so that’s on me. Appreciate you confirming the .DS_Store bit, happy the guard makes sense. I’ll keep the relative paths going forward and leave the .DS_Store check in. Thanks again for the quick response. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I deployed the Chapter 7 Swimclub webapp to PythonAnywhere. The homepage loads at https://adrian101.eu.pythonanywhere.com/ but clicking “swimmers” triggers an Internal Server 500 Error.
I found two likely issues:
On PythonAnywhere those paths don’t exist.
This crashes if the file isn’t present.
I updated the code to use paths relative to the app directory and guarded the .DS_Store removal:
Also, when generating charts:
I hope this is useful to anyone else deploying the Swimclub app on PythonAnywhere. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions