How to setup emacs for python (django) development

Lately, I decided to use emacs for all my development. If, I use emacs I will have my development environment trough terminal. so I can remotely connect my computer and do my development. When I discover how emacs works (and what emacs is), I really like the idea of using emacs for my work and personal projects.

Even though I made my mind for using emacs for development, there was a little problem. Comparing to newer IDE’s like eclipse, emacs was really hard to modify, I had really hard time to understand how it works. So I decided to write my experience for others to speed up to beginning process (which seems to be the hardest part of switching to emacs)

Before I start to write how did I setup my environment, I would like to tell you about sources I read. The best place you can go to understand how emacs work is emacs manual. This manual is about every aspect of emacs. You can also find same manual in emacs itself so try to learn how it is constructed. There is also a wiki for emacs: .

Here is how to modify emacs. Emacs plug-ins are written in elisp (emacs lisp: A language specifically written to implement emacs. You can also use it in emacs to modify emacs on the fly.) When emacs is opened. ~/.emacs file is executed. There should be elisp code in this file. As a name convention you also create ~/.emacs.d directory to hold plug-in codes. emacs does not check this directory. you have to add it to emacs load path. So I created .emacs file and .emacs.d directory under my home directory. And inside .emacs file I added following code
(add-to-list ‘load-path “~/.emacs.d/”)
This turned out to be a elisp code.

Add Python Support

To use django I need to have a python environment. So I found a blog post. But this post was  not telling how to set his environment but just giving the source code. Since I don’t know elisp I couldn’t really modify his version. After going trough similar pages I found a helpful page in emacs wiki. So I just follow comments in this page.
first of all I installed rope, ropemacs , pymacs and ropemode like it suggested. you can install ropemacs, ropemacs , pymacs from ubuntu repo.
sudo apt-get install python-rope python-ropemacs pymacs ropemacs can be install from its homepage. just download the package. call
python build
sudo python install
within the package.

After that I installed autocompete.el as page explains. At this point, I had auto-complete functionality for python and it is really cool. I also installed python-mode from ubuntu repo. but I don’t really know that it did to emacs. (sudo apt-get install python-mode).

Lastly I followed the wiki and installed pylookup. so I can lookup python documentation within emacs.

For now this is my set up. It is minimal but in time I will add new features to it.

Here is a screenshot of what result is look like:

Enable IDO Mode

Ido mode is what makes finding buffers and opening files a snap. normally finding a file is really really hard and if you want to open another file you have to go trough same cumbersome process. Emacs is just not usable without ido mode. Ido mode gives you autocompletion in opening buffers an files. it searches in current list and gives you your alternatives. It is just really easy to open files with ido mode. To enable it just follow instructions in emacs wiki page.

TODO: add js support. add python validation.

NOTE: I wrote another version of this post: It can be found in my new blog . In new version I covered my django emacs setup in three different blog post


One Response to How to setup emacs for python (django) development

  1. I have been web surfing greater than 3 hours presently, however i certainly not observed almost any fascinating post just like your own property. It’s beautiful value adequate in my opinion. In my opinion, in case virtually all internet marketers and also people made good written content when you most likely did, online will probably be far more practical than in the past.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: