longtailfinancial / panel-app-heroku

Template Repo to deploy python panel app on heroku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panel App Heroku Template

Template Repo to deploy python panel app on heroku


To get started working with Heroku signup for a free account and download and install the CLI. Once you are set up follow the instructions to log into the CLI.

  1. Clone this repository

  2. Add a Jupyter notebook or Python script which declares a Panel app along with dependent files to the repository.

  3. Try running the panel app locally using this repo's environmemt before deploying. As Heroku allows only few pushes to the app. Update requirements.txt if necessary.

  4. Create a heroku app using the CLI. This would generate URL for app and github:

heroku create app-name
  1. Modify the Procfile according to your app:

    • model/app.py with servable panel app
    • app-name.herokuapp.com which you generated in the above step
  2. Set github remote to push to heroku. Use git URL from step 3

git remote add heroku https://git.heroku.com/app-name.git 
  1. Git Commit and Push the app to heroku and wait until it is deployed:
git add .
git commit -m "init"
git push heroku master
  1. Visit the app at app-name.herokuapp.com

Modify the Procfile which declares which command Heroku should run to serve the app. In this sample app the following command serves the app.py example and the websocket origin should match the name of the app on Heroku app-name.herokuapp.com which you will declare in the next step:

web: panel serve --address="0.0.0.0" --port=$PORT model/app.py --allow-websocket-origin=app-name.herokuapp.com

Credits:

https://panel.holoviz.org/user_guide/Server_Deployment.html

https://github.com/holoviz-demos/minimal-heroku-demo/blob/master/README.md

About

Template Repo to deploy python panel app on heroku

License:MIT License


Languages

Language:Python 100.0%