Configure localhost in laptop(linux):
First of all when i created my website, i am attached a database to the webpage i.e., when a person fills the data in the site it has to go to the database, i will tell in another post how to connect webpage to the database.
Now we came to know what is localhost?
In my words localhost mean we have to run our website in our computer , and we have to act our computer like a server.In other words a local server which is deployed in your own computer .
Basic Knowledge:
To understand this you have a basic knowledge about what is port number and what is ip.
and how a network is formed .
First of all when i created my website, i am attached a database to the webpage i.e., when a person fills the data in the site it has to go to the database, i will tell in another post how to connect webpage to the database.
Now we came to know what is localhost?
In my words localhost mean we have to run our website in our computer , and we have to act our computer like a server.In other words a local server which is deployed in your own computer .
Basic Knowledge:
To understand this you have a basic knowledge about what is port number and what is ip.
and how a network is formed .
- Step1: open terminal by clicking ctrl+alt+t
- Step 2: Change the directory to the folder at where your html files are deployed by clicking cd <folder name> for example : cd web (where your folder present)
- Note :- Dont go to the folder , just go to the main folder where the files occured.
- Step 3:- type" python3 -m http.server "it becomes like this
- step 4:- Go to the browser and type "localhost:8000" in first time it sets the default port to 8000 and the next time you have to change the port number like 8899,4446 like any 4 digit number
- Eg : python3 -m http.server 7786 like any thing and in browser you have to check like localhost:7786.
- And now your html files will load here and now you are successfully .
- And if you close the terminal then the server stops running.
- Now the pyhton can act as a server so you doesn't need any special kind of plugins like apache server etc.

Comments
Post a Comment