Reactive Web Dashboards with Shiny Transcripts
Chapter: Publishing
Lecture: Publishing your app

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So now that you know how to write a Shiny application, your next question might be, How do I share it with other people?
0:06 And we have a service, a free service, called PositConnect Cloud, which lets you host all
0:12 different types of Python applications, and in the future it'll also let you host R applications.
0:16 So you can do Cordo, Shiny, Streamlit, Jupyter, Dash, and Bokeh.
0:21 And the great thing about this is it's a GitHub-enabled process, so it's really nice if you're used to using GitHub.
0:28 And also the deployment and hosting of your application is quite performant. So I'll just show you an example here.
0:36 So I have on GitHub, on this repo, an application. And one important thing about this application is it includes all the files that your Shiny
0:44 application needs, but it also needs to include a requirements.txt file.
0:48 And one thing I'd just recommend for this file is that you try to keep it minimal.
0:52 So if you use something like pip freeze, it'll sort of exactly replicate every package that you have installed, which is not necessarily what you want.
1:00 Because what's going to happen is when you deploy this application, it's going to try to install all of these packages on a Linux server.
1:07 And your working environment might include some things that are Windows-specific or Mac-specific,
1:14 which are not really installable or resolvable on the server.
1:18 So ideally what you want in this requirements.txt file are only packages that you're actually importing from.
1:24 And once you do that, it should install pretty easily. So I'll just go ahead and go to my content.
1:31 And you have this little publish content button here. And when you first sign up, you're going to sign up through GitHub, so it's aware of the
1:40 repositories that you have on your GitHub account. And we're going to select one of them. And you can pick a different branch.
1:48 In this one, I just have the one branch main. And I'll go ahead and find my ml example 2 file.
1:57 One important thing here is that when you're selecting this primary file, you select usually
2:01 the app.py file or whatever file is called the entry point of the thing that you're actually running with Shiny Run. Usually that's going to be app.py.
2:10 And then we click deploy. And it's going to clone the repository, install dependencies.
2:18 The Connect Cloud has a pretty fast dependency resolution process, so that goes pretty quickly usually.
2:23 And then it's going to publish it and spin up a little container for us. This part can take a second, but overall really fast.
2:31 And then the Shiny app is live and it's running. I'm just going to go ahead and draw those plots.
2:37 And so this is public to the internet, so you're able to share this URL with other people.
2:43 Eventually we're going to be adding additional features like private sharing and the ability to modify what that URL is.
2:51 This is in alpha as of this recording, but it's usable and it's great for sharing especially public applications that you want to learn.
2:59 So go ahead and give it a try. Deploy your applications and share it with the world.


Talk Python's Mastodon Michael Kennedy's Mastodon