title: Host a python application built on SimpleHTTPRequest on a linux server
body: <p>I have built my own webserver using SimpleHTTPRequestHandler in python. It works as expected on my local and I don't want to use any third-party libraries. If I had to host it on a Linux hosting server and up my web application, is it possible and are there any examples to do so. I am furnishing my code below,</p>
  <pre><code>from User import User
  import json
  import urllib.parse as urlparse
  from urllib.parse import parse_qs
  
  class GetHandler(SimpleHTTPRequestHandler):
  
          def do_GET(self):
              urlParts = str(self.path).split(&quot;?&quot;)
              params = urlParts[0].split(&quot;/&quot;)
              parsed = urlparse.urlparse(self.path)
              self.send_response(200)
              self.send_header('Content-type', 'appplication/json')
              self.end_headers()
              self.wfile.write(bytes(json.dumps(getattr(eval(params[1]), params[2])()), encoding='utf-8'))
              return
              
  
          def do_POST(self):
              self.send_response(200)
              self.send_header('Content-type', 'text/html')
              self.end_headers()
              self.data_string = self.rfile.read(int(self.headers['Content-Length']))
              data = json.loads(self.data_string)
              print(data)
              data = '&lt;html&gt;&lt;body&gt;&lt;h1&gt;POST!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;'
              self.wfile.write(bytes(data, encoding='utf-8'))
              return
  
  Handler=GetHandler
  
  httpd=HTTPServer((&quot;localhost&quot;, 8081), Handler)
  print(&quot;Server started on localhost:8081&quot;)
  httpd.serve_forever()
  </code></pre>