Quickest and Easiest Way to Run a Local Web-Server
Skills:
AI Pair Programming70%
Key Takeaways
The video demonstrates how to quickly and easily run a local web server using Python's SimpleHTTPServer to test a simple website, without the need for downloading programs like MAMP or setting up Apache.
Full Transcript
hey how's it going everybody in this video we're gonna take a look at how to quickly and easily spin up a local web server so if you're working on a website and you want to open that up in the browser sometimes it can be a pain to download programs like map or to do an entire set up of Apache or something like that it's kind of overkill if you just want to quickly glance at it I think the quickest and easiest way to do this is with pythons built in simple HTTP server now you will have to have Python installed but if you're on a Mac then that's gonna already be installed for you so let's take a look at how to do this first of all you want to open up your terminal so I have two terminal windows open up here and then you want to navigate to where your website is so for example I have a website here in the site's directory and then demos and then test site and if I look at the contents of this folder then the file that I want to take a look at is actually in this disk folder here so I'm going to CD into that directory and now if I do an LS in that folder then you can see here where we have the index.html file now to spin up a quick local web server and to view this file in the browser all you have to do is type in Python - M simple HTTP server and then you want to type in by default it's going to be port 8000 but I always type it in just to be sure so you type in the port number there so hit enter and you can see here in this terminal window it says serving HTTP on port 8000 so now if I go over here into my browser and type in localhost and then go to port 8000 and hit enter now you can see it opens up that test website within the browser so our local web server is running if you come over here into the terminal then you can see that it actually gives you some information - about what the web server is doing so you can see here that a get request on the route gave a 200 response and then you can see where it goes and requests the different CSS files and JavaScript files and things like that now you can minimize this terminal window here but be sure to keep it open because that is what's running your webserver so you don't want to close that down or else it'll close the web server down now the thing I like about this method is that it's so easy to spin up another server on and listen on another port so for example if I go to this other demo that I have called sample map if I CD into that directory and then LS you can see I have my index.html file here and so this other web server is still running here in the background so I could do Python - M HTTP HTTP server and I can do this on whatever port I want I'll just pick a random port at44 hit enter there so now you can see that it's serving on port 80 44 so if I go up here and go to localhost port 80 44 hit enter and now that website has is now running in the browser on that local web server listening on that port and now if you want to close down these web servers all you got to do is either close out of the terminal window or within the terminal window you can also hit control C you can see that it'll send a keyboard interrupt there and now if I try to reload that page then that server is no longer running and if I do it up here as well and try to reload this page and you can see that it's no longer listening on that port so you can see how a method like this is a lot faster than downloading a program like map or trying to set up a patchy or something like that just to quickly look at your website within the browser so that about does it for this video hopefully you guys found this quick tip useful but if you do have any questions and just ask in a comment section below be sure to subscribe for future videos and thank you guys for watching
Original Description
Running a local web-server to test a simple website is sometimes way harder than it has to be. In this video, we will look at a quick and simple way to run a local web-server using python's SimpleHTTPServer. It's literally as simple as navigating to your website folder and running the server. No downloads, configurations, or unneeded bells and whistles.
✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms
✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join
✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
http://a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - http://coreyms.com/
My Second Channel - https://www.youtube.com/c/coreymschafer
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Instagram - https://www.instagram.com/coreymschafer/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Corey Schafer · Corey Schafer · 45 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
▶
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Web fonts using CSS Font Face
Corey Schafer
Using Font Awesome in Desktop Applications (OS X)
Corey Schafer
Sublime Text 2: Setup, Package Control, and Settings
Corey Schafer
ArcGIS API for JavaScript Part 1: Our First Web Map
Corey Schafer
Mac Tip: Windows' Snapping Feature on Mac with HyperDock
Corey Schafer
Linux/Mac Terminal Tutorial: Creating Aliases for Commands
Corey Schafer
ArcGIS API for JavaScript Part 2: Starting Templates
Corey Schafer
Paver Patio Time Lapse
Corey Schafer
Mac Tip: Ways to perform Screen Capturing and Screenshots
Corey Schafer
WordPress Plugins: Imsanity
Corey Schafer
WordPress Tips: Test your theme with Theme Unit Test and Monster Widget
Corey Schafer
Sublime Text 3: Setup, Package Control, and Settings
Corey Schafer
Understanding Binary, Hexadecimal, Decimal (Base-10), and more
Corey Schafer
Mac Tip: Adding Folder Stacks to the Dock
Corey Schafer
CSS Tips and Tricks: Add External URLs to Print Stylesheets
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 7 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 1 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 5 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 4 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 3 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 2 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 6 of 7)
Corey Schafer
Python Tutorial: if __name__ == '__main__'
Corey Schafer
Sublime Text Quick Tip: "Go To Definition" Click Shortcut
Corey Schafer
How to quickly create favicons for the desktop, Apple/Android devices, tablets, and more
Corey Schafer
Easily Resize Multiple Images Using Picasa
Corey Schafer
Easily Resize Multiple Images Using the Mac Terminal
Corey Schafer
Python Tutorial: virtualenv and why you should use virtual environments
Corey Schafer
Python Tutorial: pip - An in-depth look at the package management system
Corey Schafer
Git Tutorial: Using the Stash Command
Corey Schafer
How Software Engineers, Developers, and Designers can volunteer their skills
Corey Schafer
Git Tutorial: Diff and Merge Tools
Corey Schafer
Git Tutorial: Change DiffMerge Font-Size on Mac OSX
Corey Schafer
Sublime Text Quick Tip: Launch Sublime Text from the Terminal
Corey Schafer
Python Tutorial: str() vs repr()
Corey Schafer
Programming Terms: DRY (Don't Repeat Yourself)
Corey Schafer
Programming Terms: String Interpolation
Corey Schafer
Programming Terms: Idempotence
Corey Schafer
Python Tutorial: Namedtuple - When and why should you use namedtuples?
Corey Schafer
Programming Terms: Mutable vs Immutable
Corey Schafer
Python Tutorial: Else Clauses on Loops
Corey Schafer
Overview of Online Learning Resources
Corey Schafer
Mac OS X Terminal Tutorial: Time-Saving Keyboard Shortcuts
Corey Schafer
Git Tutorial for Beginners: Command-Line Fundamentals
Corey Schafer
Quickest and Easiest Way to Run a Local Web-Server
Corey Schafer
Python Tutorial: Generators - How to use them and the benefits you receive
Corey Schafer
Python Tutorial: Comprehensions - How they work and why you should be using them
Corey Schafer
Chrome Quick Tip: Quickly Bookmark Open Tabs for Later Viewing
Corey Schafer
Programming Terms: Combinations and Permutations
Corey Schafer
Git Tutorial: Difference between "add -A", "add -u", "add .", and "add *"
Corey Schafer
Preparing for a Python Interview: 10 Things You Should Know
Corey Schafer
SQL Tutorial for Beginners 1: Installing PostgreSQL and Creating Your First Database
Corey Schafer
SQL Tutorial for Beginners 2: Creating Your First Table
Corey Schafer
SQL Tutorial for Beginners 3: INSERT - Adding Records to Your Database
Corey Schafer
Linux/Mac Terminal Tutorial: Navigating your Filesystem
Corey Schafer
Python: Ex Machina Easter Egg - Hidden Message within the Code
Corey Schafer
Mac Tip: New Split Screen Feature in El Capitan
Corey Schafer
Setting up a Python Development Environment in Eclipse
Corey Schafer
Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits
Corey Schafer
SQL Tutorial for Beginners 4: SELECT - Retrieving Records from Your Database
Corey Schafer
More on: AI Pair Programming
View skill →
🎓
Tutor Explanation
DeepCamp AI