How can i test my changes before hitting the Reload button in Pythonanywhere?

84 views Asked by At

I want to test my updates and changes before hitting the Reload www.yourdomainname.com button to make sure that there are no server error 500 or any bad thing that could happen so I don't lose users, is there any way to do so? when I do python3 manage.py runserver It tells me

Watching for file changes with StatReloader                                                                                               
Performing system checks...                                                                                                               
                                                                                                         
System check identified no issues (0 silenced).                                                                                           
September 05, 2020 - 08:18:49                                                                                                             
Django version 3.1, using settings 'dfreemedia.settings'                                                                                  
Starting development server at http://127.0.0.1:8000/                                                                                     
Quit the server with CONTROL-C.                                                                                                           
Error: That port is already in use.

even though i'm not using it

1

There are 1 answers

1
das-g On

You could use an additional PythonAnywhere account and deploy the same code and data to it and make sure the settings are the same. Then you can click "Reload" on that additional account first, check whether everything is working there, and only click "Reload" on your production account when that is the case.

That'd effectively give you a pre-production environment.

Warning: This assumes that your project either does not access any resources outside of PythonAnywhere, or that it's fine if all such external resources are accessed by several instances of your application. If that isn't the case you'd need a more elaborate approach.

Note: For signing up an additional PythonAnywhere account you need to give a different email address. Last time I checked, their Terms of Service did not disallow getting several accounts (even several free accounts) that way, but you'll want to check their Terms of Service at the time you'd do this, to make sure they're still fine with it.