How to start a Python server with parameters on another Python server


So my problem is that I have a server which returns a JSONobject to the user when the user sends a string to its URL-adress. The problem is that this server needs the parameters:
hostname, port (when it is started)
from the users pc in order to serve the user with the JSONobjects.

So I will first have to start a server manually (we can call it getserver1) and the code of the server is (Don’t care about the import-stuff, its just to enable it on both python 2 and 3):

#!/usr/bin/env python
    # Python 3
    from http.server import HTTPServer, SimpleHTTPRequestHandler, test as test_orig
    import sys
    def test (*args):
        test_orig(*args, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)
except ImportError: # Python 2
    from BaseHTTPServer import HTTPServer, test
    from SimpleHTTPServer import SimpleHTTPRequestHandler

class CORSRequestHandler (SimpleHTTPRequestHandler):
    def end_headers (self):
        self.send_header('Access-Control-Allow-Origin', '*')

if __name__ == '__main__':
    test(CORSRequestHandler, HTTPServer)

On this server I have put a html-file with the code:

        <script src=""></script>

               url: "http://user-pc:8000/",
               success: function(response) {


The error I get is the: No “Access-Control-Allow-Origin”
when the html file is run. The code of the has the same code as the getserver1 above which should allow the “Access-Control-Allow-Origin”.

So how can I get this to work. I would like to not involve any new elements as php or something like that into the stew.

Also, the next problem when this works is to start the getserver2 with the 2 parameters (So yes getserver2 is a little different from getserver1 but only in the sense that it takes the two parameters). But the test I’m doing right now uses the same code in both servers to start with.