diff --git a/jupyterhub/app.py b/jupyterhub/app.py index 1fc07459..98b21e59 100644 --- a/jupyterhub/app.py +++ b/jupyterhub/app.py @@ -180,7 +180,7 @@ class JupyterHub(Application): generate default config file: - jupyterhub --generate-config -f /etc/jupyterhub/jupyterhub.py + jupyterhub --generate-config -f /etc/jupyterhub/jupyterhub_config.py spawn the server on 10.0.1.2:443 with https: @@ -1346,6 +1346,11 @@ class JupyterHub(Application): def write_config_file(self): """Write our default config to a .py config file""" + config_file_dir = os.path.dirname(os.path.abspath(self.config_file)) + if not os.path.isdir(config_file_dir): + self.exit("{} does not exist. The destination directory must exist before generating config file.".format( + config_file_dir, + )) if os.path.exists(self.config_file) and not self.answer_yes: answer = '' def ask():