These steps will get this sample Python application running for you using DigitalOcean App Platform.
Note: Following these steps may result in charges for the use of DigitalOcean services
- You need a DigitalOcean account. If you don't already have one, you can sign up at https://cloud.digitalocean.com/registrations/new
Click this button to deploy the app to the DigitalOcean App Platform. If you are not logged in, you will be prompted to log in with your DigitalOcean account.
Using this button disable the "Auto deploy changes on push" feature as you are using this repo directly. If you wish to try that feature, you will need to make your own copy of this repository.
To make a copy, click the Fork button above and follow the on-screen instructions. In this case, you'll be forking this repo as a starting point for your own app (see GitHub documentation to learn more about forking repos.
After forking the repo, you should now be viewing this README in your own github org (e.g. https://github.com/<your-org>/sample-python
). To deploy the new repo, visit https://cloud.digitalocean.com/apps and click "Create App" or "Launch Your App". Then, select the repository you created and be sure to select the main
branch.
After clicking the "Deploy to DigitalOcean" button or completing the instructions above to fork the repo, follow these steps:
- Select which region you wish to deploy your app to and click Next. The closest region to you should be selected by default. All App Platform apps are routed through a global CDN so this will not affect your app performance, unless it needs to talk to external services.
- On the following screen, leave all the fields as they are and click Next.
- Confirm your Plan settings and how many containers you want to launch and click Launch Basic/Pro App.
- You should see a "Building..." progress indicator. And you can click "Deployments"→"Details" to see more details of the build.
- It can take a few minutes for the build to finish, but you can follow the progress by clicking the "Details" link in the top banner.
- Once the build completes successfully, click the "Live App" link in the header and you should see your running application in a new tab, displaying the home page.
If you followed the steps above to fork the repo and used your own copy when deploying the app, you can enjoy automatic deploys whenever changes are made to the repo. During these automatic deployments, your application will never pause or stop serving request because App Platform offers zero-downtime deployments.
Here's an example code change you can make for this app:
- Edit
server.py
and replace "Hello!" on line 12 with a different greeting - Commit the change to the
main
branch. Normally it's a better practice to create a new branch for your change and then merge that branch tomain
after review, but for this demo you can commit to themain
branch directly. - Visit https://cloud.digitalocean.com/apps and navigate to your sample app.
- You should see a "Building..." progress indicator, just like when you first created the app.
- Once the build completes successfully, click the "Live App" link in the header and you should see your updated application running. You may need to force refresh the page in your browser (e.g. using Shift+Reload).
You can learn more about the App Platform and how to manage and update your application at https://www.digitalocean.com/docs/app-platform/.
When you no longer need this sample application running live, you can delete it by following these steps:
- Visit the Apps control panel at https://cloud.digitalocean.com/apps
- Navigate to the sample app
- Choose "Settings"->"Destroy"
Note: If you don't delete your app, charges for the use of DigitalOcean services will continue to accrue.