Previews and Snapshots5:10 with Nick Pettit
Workspaces is more than just a text-editor. You can also preview your work or create a Workspace Snapshot to share your code with other Treehouse students.
Once you're finished writing your code with workspaces, 0:00 you can preview your website or web application and 0:03 you can also take a snapshot to share the workspace with others. 0:06 Lets take a look. 0:11 I'm going to click on this workspace to open it up. 0:12 But you could be using any workspace that you like. 0:16 Down at the bottom, I'm going to close the console window for 0:19 now, because I won't need it just yet. 0:22 And in the upper right corner, you'll notice that we have a few icons here. 0:24 We've already learned about forking and here, 0:29 I can fork a workspace directly from inside the workspaces interface. 0:32 But I can also preview this workspace. 0:37 So this is a simple HTML and CSS website that I've created. 0:41 And as you might expect with an HTML website, 0:46 the index page is the default page. 0:49 So when i click on the Preview button, it will open up this website and 0:52 bring me to index.html. 0:57 This allows you to preview your site as you're working with your code, but 1:00 these preview URLs are short-lived. 1:05 So while it looks like you could copy and paste this and 1:09 share it in a tweet, or share it in the Treehouse community. 1:12 You don't wanna do that because as soon as you close your workspace, 1:16 these preview URLs will expire. 1:20 So you don't want to share a preview URL. 1:24 It's just for previewing your workspace while you're writing code. 1:27 However, if you would like to share your workspace with other Treehouse students. 1:33 You can click on the Snapshot button and click the button that says Take Snapshot. 1:40 This will create a snapshot of your 1:48 current workspace in whatever state it's in right now. 1:51 And then, you can click on this link to view the snapshot. 1:55 And this link, you can share in the Treehouse community. 2:01 And when people click on it, they'll see a screen that looks just like this. 2:05 This is great if you want to share your workspace with other Treehouse students. 2:11 Especially if you're stuck on a big problem and you need some help with it. 2:16 That way, other Treehouse students can see exactly what you're working on. 2:21 In addition, you can also fork snapshots. 2:25 So, when somebody else on Treehouse opens up your workspace. 2:30 They could click on Fork Snapshot, maybe fix whatever problem you're having. 2:33 And then share the workspace back with you to show you the solution. 2:39 For now, I'm going to close this snapshot and 2:44 then I can actually delete snapshots from that same menu. 2:48 The last thing I want to show you is the console in workspaces. 2:53 So let me close this particular workspace and 2:57 I'm going to open this Python Workspace. 3:01 Workspaces is great for creating simple HTML and simple CSS websites. 3:05 But you can also work with numerous back end languages, like Python, Ruby or PHP. 3:10 Here, I have a simple Python application that's written in flask and 3:16 I can actually run this Python application from the console. 3:22 If you console is closed and you can't see it, 3:29 you can go up to the View menu and choose Show Console. 3:32 You can also adjust the size of the console relative to the text editing area. 3:38 If you want some more space to work in your console. 3:44 If you haven't worked with back end languages before, you need to start 3:47 a server in order to run any kind of web application that you write. 3:53 So from the console, I can type in python, because I'm running a Python application. 3:58 And then I can choose which application I want to run, I only have one here. 4:06 So I'm going to run this simple_app.py for Python and then hit Enter. 4:11 And the console will tell me that it's now running on port 8000 and 4:20 I can hit Ctrl+C to quit the application and stop it from running. 4:26 Then in the upper right, when I click on the Preview button, it will give me a list 4:32 of ports because you could be running several applications on different ports. 4:38 So now when I click on port 8000, it will open the Preview window. 4:45 And this is just a very simply Python application that 4:50 just says hello from Treehouse. 4:53 But you can see a preview of your application running. 4:55 Hopefully this tour of workspaces has been useful to you. 4:59 As you go through more Treehouse courses, you'll learn more about workspaces and 5:03 become much more comfortable using it. 5:07
You need to sign up for Treehouse in order to download course files.Sign up