From the course: Learning Infrastructure for Developers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Run localhost with Python
From the course: Learning Infrastructure for Developers
Run localhost with Python
- [Instructor] With Python, we can create a simple server with just one command. Depending on whether you have Python Two or Python Three installed, you can run one of these two commands to create and start up a server. This Python web server will serve the contents of the folder it is run in. So before we run the command, let's make a new directory. We'll call this directory contents and cd into it. Then, we'll create a text file using nano and add a simple hello statement. We'll call this file hello.txt. This opens the nano editor. You're welcome to use them or another text editor in the command line or make a text file in a different way. In this file, I'll write, Hi this is me from your computer. Then I'll do control O to write out the file and save the file and then control X to exit out of that editor. If we run ls, we should see the hello.txt file inside of our contents directory. Let's run the Python command.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.