emacs下django的配置

Table of Contents

Django setup

ref: emacs django config

  1. install virtualenvwrapper
    install virtualenvwrapper
  2. install python-django.el
    install it via elpa
  3. bind key to open project
    in the .emacs config

    (require-package 'python-django)
    (require 'python-django)
    (global-set-key (kbd "C-x j") 'python-django-open-project)
    
  4. set emacs config environment virables for django project
    goto project root

    cd /path/to/django/project
    touch .dir-locals.el
    

    and input this to .dir-locals.el

    ((python-mode
      (python-shell-interpreter . "python")
      (python-shell-interpreter-args . "/home/robin/Env/mezproj/project/manage.py shell")
      (python-shell-prompt-regexp . "In \\[[0-9]+\\]: ")
      (python-shell-prompt-output-regexp . "Out\\[[0-9]+\\]: ")
      (python-shell-completion-setup-code . "from IPython.core.completerlib import module_completion")
      (python-shell-completion-module-string-code . "';'.join(module_completion('''%s'''))\n")
      (python-shell-completion-string-code . "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
      (python-shell-extra-pythonpaths "/home/robin/Env/mezproj/lib/python2.7/site-packages/")
      (python-shell-virtualenv-path . "/home/robin/Env/mezproj")))
    
  5. 添加web-mode
    install web-mode via elpa

    (require 'web-mode)
    (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
    
    (setq web-mode-engines-alist
          '(("django"    . "\\.html\\'")
            ("django"  . "\\.djhtml\\."))
    )
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值