Reply To: running penncontroller locally

PennController for IBEX Forums Support running penncontroller locally Reply To: running penncontroller locally



I have come up with two little python3 scripts to handle this, they can be found here:

* takes a full experiment folder’s structure (ie. a folder with the chunk_includes, css_includes, data_includes, js_includes, other_includes, www subfolders) and outputs a standalone, static experiment in another folder. The resulting experiment can be run entirely locally in a web browser, without even needing a local server. That being said, because of the absence of a server, it won’t support automatic update of the counter or sending of the results: by default the counter will be set to a random value between 0 and 1000, or to the value passed to the withsquare parameter in the URL, and the browser will open a prompt to download the results as a file on the device. You can still run the output on a server: to obtain the exact same behavior, make sure to pass static=1 as a parameter in the URL, or don’t pass it if you want to handle the counter and the results file on the server. Usage example: python3 -i ./ibex_exp -o ~/static_exp

* will run a very simple server that handles counter updates, saving results and serving files. Note that it was not designed to be used as a public web server, although it could technically be implemented as such — it works well as a local server though. It will run at localhost:3000 by default, but you can update the port by setting PORT at the top of the script to a different value. Also make sure to edit PRIVATE_DIRECTORY and PUBLIC_DIRECTORY to point to the directories you want to use on your machine: PRIVATE_DIRECTORY is where you will have the counter and results file, and it should not be publicly exposed (although if you’re running a local server, it doesn’t matter much); PUBLIC_DIRECTORY is the directory serving files, and it should be set to point to the output folder of above (in this example, ~/static_exp/) this way it can serve multimedia files, for example. Finally note the line response.headers["Access-Control-Allow-Origin"] = "*": this will accept incoming requests from any domain (including localhost, crucially) so make sure to edit it if you need to make things more secure. Usage example: python3