Python: Deploying to staging environment

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 in just seconds with a simple git push.
  • Use your own domain name, with automatic HTTPS certificate setup for secure connections managed for you.
  • Take advantage of automatic backups, one-click updates, and predictable pricing, so you can focus on your code instead of 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.

Maintaining separate staging and production environments is highly recommended. To manage multiple environments, start by renaming the current remote repository. For example, rename the remote stackhero to stackhero-production with:

git remote rename stackhero stackhero-production

Next, create a new Python service for your staging environment. Retrieve the git remote add command and modify it by replacing <XXXXXX> with your service's domain:

  • Original command:

    git remote add stackhero ssh://stackhero@<XXXXXX>.stackhero-network.com:222/project.git
    
  • Modified command:

    git remote add stackhero-staging ssh://stackhero@<XXXXXX>.stackhero-network.com:222/project.git
    

You can then deploy to either environment using the following commands:

  • Deploy to staging:

    git push stackhero-staging main
    
  • Deploy to production:

    git push stackhero-production main
    

To enhance the deployment process, we suggest utilizing the improved Makefile version.

With this improved Makefile, deploying to production or staging becomes as simple as running make deploy-production or make deploy-staging.