Python: Rolling back to a previous version
This documentation is part of the Advanced usages guide. View the full guide here: Going further with your Python deployments.
👋 Welcome to the Stackhero documentation!
Stackhero provides a ready-to-use Python cloud solution designed to streamline your deployment process:
- Deploy your application to production in seconds with a simple
git push.- Use your own domain name, with automatic HTTPS certificate configuration for secure connections handled for you.
- Rely on automatic backups, one-click updates, and predictable pricing, so you can focus on your code, not infrastructure management.
- Benefit from strong performance and security on a private, dedicated infrastructure. Your environment is isolated and protected.
Save time and simplify your workflow: you can have your code 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.