From 1c1b12ae7e8b41e5fb4279ce0e633cc6f094ed59 Mon Sep 17 00:00:00 2001 From: Manuel Morales Date: Fri, 22 Jan 2016 09:33:09 -0600 Subject: [PATCH] issue #23 milestone --- Default.sublime-commands | 4 ++++ README.md | 15 ++++++++++----- django-commands.py | 4 ++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Default.sublime-commands b/Default.sublime-commands index 62de9f7..506733d 100644 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -79,6 +79,10 @@ "caption": "Django: Search in Docs", "command": "django_search_docs" }, + { + "caption": "Django: Set Project Interpreter", + "command": "set_project_interpreter" + }, { "caption": "Django: Shell", "command": "django_shell" diff --git a/README.md b/README.md index c5f4070..c469dcc 100644 --- a/README.md +++ b/README.md @@ -76,22 +76,27 @@ Currently supports following commands: * `Django: Pip Freeze To File` * `Django: Pip Install Packages` * `Django: Pip Install Requirements` + * `Django: Set Project Interpreter` ### Settings * `python_bin`: path to python interpreter * `python_version` : default python interpreter version - * `python_virtualenv_paths`: list of paths where virtualenvs are located (ex:`~/.virtualenvs/`)* + * `python_virtualenv_paths`: list of paths where virtualenvs are located (ex:`~/.virtualenvs/`)*\* * `server_host`: host for the runserver command * `server_port`: port for the server to listen - * `linux_terminal`: Only Linux setting for command line emulator + * `linux_terminal`: Only Linux setting for command line emulator\*\* * `project_override`: (Boolean) Per project setting "python_interpreter" overrides "python_bin" - * `server_custom_command`: Per project setting to specify a custom server to run (ex: {"command": "gunicorn", "args":["--workers=3"]}) __use any script you want__ + * `server_custom_command`: Per project setting to specify a custom server to run (ex: {"command": "gunicorn", "args":["--workers=3"]})\*\*\* + +\*It's important to set your envs directories + +\*The folders in this list should be the parent folder of the virtualenv folder, not the virtualenv folder itself - __It's important to set your envs directories__ +\*\*Check that your 'linux\_terminal' setting uses an underscore "\_" - __Check that your 'linux\_terminal' setting uses an underscore "\_"__ +\*\*\*use any script you want ### Please report any issue, bug, enhacement or comment [here](https://github.com/vladimirnani/DjangoCommands/issues) ### We'll be glad to read and work on all of them diff --git a/django-commands.py b/django-commands.py index 5ff4476..81a811c 100644 --- a/django-commands.py +++ b/django-commands.py @@ -486,6 +486,10 @@ def set_project_interpreter(self, venvs, index): if index == -1: return project = self.window.project_data() + if "settings" in project.keys(): + pass + else: + project["settings"] = {} project["settings"]["python_interpreter"] = os.path.join(venvs[index][1], 'python') self.window.set_project_data(project)