Python: Rolling back to a previous version
This documentation is part of the Advanced usages guide. You can view the complete guide here: Going further with your Python deployments.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Python cloud solution designed to simplify your deployments:
- Deploy your application to production within seconds using a simple
git push.- Use your own domain name, with automatic HTTPS certificate setup for secure connections managed on your behalf.
- Take advantage of automatic backups, one-click updates, and predictable pricing, so you can focus on your code rather than infrastructure management.
- Benefit from high performance and security on a private, dedicated infrastructure. Your environment is isolated and protected.
Save time and streamline your workflow: your code can be up and running with Stackhero's Python cloud hosting in just 5 minutes.
If a recent deployment has introduced issues, you can revert to an earlier commit by deploying that commit. First, identify the commit hash by running:
git log
This command displays each commit's date, hash, and description.
For example, the output might look like this:
git log
commit cccc8b3ebdccb9abc1926ef49ee589dae5c5fe06 (HEAD -> main, stackhero/main)
Author: Developer
Date: Fri Apr 28 09:36:18 +0000
Break the code
commit bbbb622301772072c3d82f3cc0d91e29e6e84901
Author: Developer
Date: Wed Apr 26 12:49:28 +0000
Update the code
commit aaaa1d8b06535b413e0df8298ccf52339dfef3ff
Author: Developer
Date: Wed Apr 26 12:44:50 +0000
Improve the code
If the current production deployment is the commit "Break the code" (hash starting with cccc), and you wish to revert to the previous commit "Update the code" (hash starting with bbbb), execute:
git push -f stackhero bbbb622301772072c3d82f3cc0d91e29e6e84901:main
To prevent deploying broken code and increase the stability of your production, it is highly recommended to have a "staging" environment.
Situated between development and production, the staging environment provides a near replica of the production setup. It helps you test your code thoroughly before a live deployment.
Utilizing staging increases your confidence in the functionality and performance of your code, resulting in a more robust production deployment.
This type of environment will be discussed later in the documentation.