本文介绍了Sublime Text 3中带有Anaconda的Django Autocomplete的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Anaconda插件在Sublime Text 3中进行自动补全.到目前为止,我已经成功实现了自动补全功能,可以使用标准python库工作,但不适用于Django.

I'm trying to get autocompletion working in Sublime Text 3 via the Anaconda plug-in. So far I've been successful getting autocompletion working with the standard python libraries but not for Django.

我的崇高项目文件如下:

My sublime project file looks like this:

{
  "folders": [
    {
      "follow_symlinks": true,
      "path": "."
    }
  ],

  "settings": {
    "python_interpreter": "/Users/user/.virtualenvs/project/bin/python",
    "suppress_word_completions": true,
    "extra_paths":
    [
        "/Users/user/.virtualenvs/project/lib/python2.7/site-packages"
    ],
    "anaconda_debug": true,
  },

  "build_systems":
    [
        {
            "name":"Virtualenv 2.7 Project",
            "shell_cmd": "/Users/user/.virtualenvs/project/bin/python -u \"$file\"",
            "path": "/Users/jamiehush/.virtualenvs/project/bin",
            "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
            "selector": "source.python"
        }
    ]
}

我还在虚拟环境中从终端运行"subl".

I'm also running "subl" from a terminal while inside a virtual environment.

推荐答案

您不需要任何特殊的extra_path即可使Django自动完成工作. Django没什么特别的,anaconda应该能够自动完成您配置的python解释器可见的所有内容.

You shouldn't need any special extra_path to make autocompleting work with Django. Nothing make Django special, anaconda should be able to autocomplete whatever is visible by your configured python interpreter.

确保project中的虚拟环境上已安装Django的副本.如果您已安装virtualenwrapper,则应尽可能简单:

Make sure that the virtual environment in project has a copy of Django installed on it. If you have virtualenwrapper installed should be as easy as:

$ workon项目

$ workon project

$ python

import django

如果您的virtualenv中包含Django,则可能是在安装库之前启动了anaconda JsonServer,并且看不到它.重新启动Sublime Text 3,然后重试.

If you have Django in your virtualenv, is possible that the anaconda JsonServer was started before you installed the library and it's not able to see it. Restart your Sublime Text 3 and try again.

如果您仍然遇到问题,请发送电子邮件到anaconda的邮件列表,或在Github项目中打开问题( https://github.com/DamnWidget/anaconda/issues ),指明您使用的操作系统,ST3版本和Python版本,以便我们为您提供进一步的帮助.

In case that you still have problems, send an email to the anaconda's mailing list or open an issue in the Github project (https://github.com/DamnWidget/anaconda/issues) indicating your operating system, ST3 build and Python version that you are using so we can help you further.

这篇关于Sublime Text 3中带有Anaconda的Django Autocomplete的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 07:46