Skip to content

Commit

Permalink
adds and option on startup to move to a different subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
gureckis committed Mar 26, 2021
1 parent d81d353 commit d781d4f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions psiturk/experiment_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ class ExperimentServer(Application):
Custom Gunicorn Server Application that serves up the Experiment application
"""

def __init__(self):
def __init__(self, app_dir=None):
"""__init__ method
Load the base config and assign some core attributes.
"""

self.loglevels = ["debug", "info", "warning", "error", "critical"]
self.load_user_config()
self.usage = None
self.callable = None
self.options = self.user_options
self.prog = None
self.do_load_config()
if app_dir:
self.cfg.set('chdir', app_dir) # get directory
self.chdir() # change to it
self.user_options = {}
print("Now serving on", "http://" + self.options["bind"])

Expand Down Expand Up @@ -106,8 +110,8 @@ def load_user_config(self):
{'timeout': config.get('Server Parameters', "server_timeout")})


def launch():
ExperimentServer().run()
def launch(app_dir=None):
ExperimentServer(app_dir).run()


if __name__ == "__main__":
Expand Down

0 comments on commit d781d4f

Please sign in to comment.