skip to Main Content

I am working in a website project, and I am want make test in my cellphone for the responsive, but I don´t want unpload my project to a server, so, I saw that I can create a server with my computer and my local wifi, so I saw that I would create a file and import any things, but I don´t remember the things that I would do.

I want the file/script that can do this, and the explications for any modules.

3

Answers


  1. Here are some guides on making a node.js along with a python webserver

    https://www.youtube.com/watch?v=VShtPwEkDD0 – node.js

    https://pythonbasics.org/webserver/ <- py

    This should answer everything you need

    Login or Signup to reply.
  2. Here’s a python script for a simple web server:

    import http.server
    import socketserver
    
    PORT = 8000
    
    Handler = http.server.SimpleHTTPRequestHandler
    
    with socketserver.TCPServer(("", PORT), Handler) as httpd:
        print(f"Serving at http://localhost:{PORT}")
        httpd.serve_forever()
    
    Login or Signup to reply.
  3. A oneliner directly from terminal, if someone wants

    python3 -m http.server 8000
    

    run it in the same directory as your index.html/home.html/ your root files exists

    Then you should be able to open http://IP_OF_YOUR_PC_ON_LOCAL_NETWORK:8000 on your mobile’s browser

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search