Forums

using a web app as a test environment

I'm struggling a bit with something and I've got to the point where I'm worried that conceptually I might be doing something wrong.

I've got a web app, its a few tools for football coaches in the club my kids are in. Django based and fairly simple, as I'm trying to recover my dev skills.

My idea is to dev locally and do some testing on features there, but then to commit to a github repo, let the action deploy that branch to my PA app. Here i can test it properly as a hosted web app, let a few coaches test with me, etc.

this means i end up with an SSH deploy script, which looks something like

ssh, get branch name, stash changes, pull latest, change branch, swap to correct settings file, touch wsgi file

My issue is that is problematic. Part of the issue is that I'm making changes to files within the web app after deploying it. i change the settings file to reflect the environment (test - debug=true for example). this then leads to the next pull failing, because the stash doesnt work, or ive got uncommitted changes.

Its not very reliable.

so my question is, do i persist with this, until i run out of issues to solve, or have i totally missed the point of how to work with python anywhere apps? is there a better pattern? while typing this, ive come up with the thought that i maybe should be creating a new webapp every time i deploy, but i'd prefer not to do that when it comes to creating a prod web app. What are other people doing?

I think the best solution would be to keep any changes you make in PythonAnywhere out of source control. For example, you could have an environment variable that you use to switch between dev and prod settings.