Run '/main/build.exe' to run the standalone build of the http server
The server has been build using PyInstaller 3.5
To run the web server from source run main_server.py
using python 3.7 (no modules required)
Override server_request.ServerRequest
Add POST logic to post_request
function and GET logic to get_request
function
both GET and POST function MUST return a tuple with response status, page content
Use parse_response
function to parse the page content into a json string.
The Json string contains the response status
and the page content
it is possible to force the response status to 200 (OK)
while the Json string
contains the true status by setting force_200_status = True
. This is helpful
for APIs allowing you to send improved error messages.
Use new_response
function to format the json string as {"status": status, "response": {response_data}}
(For more info see doc strings)
Locate file 'server_setup.py' and create an instances of your server_request class
in the setup
function and call self.add_callback
with params root_dir
and the server_request instances.
DONE!
see sql_query.py
for sql_lite helper functions; or
checkout to the 'mysql_support' branch for use with MYSQL databases
(MYSQL Support has NOT been tested with the current included modules)
see helpers.py
for general helper functions
host, port and database_root can be changed at the top of main server
# config
GlobalConfig.set("host", "127.0.0.1")
GlobalConfig.set("port", 8000)
GlobalConfig.set("db_root", "databases/")
Run Test.py
using python 3.7