I've found that a particularly nasty place for this to happen is on the
deployment server, when, as is common, it is a *nix where the convenient
editor to use over ssh is vim (or vi).  The typical installation is
either unaware
of python at all as a file type, or handles it poorly.  Things will be
much better if you do:

   :setl nosr nosta sw=4 sts=4 ts=8 et

If you want to put this in your account's .exrc file then leave off the
leading colon.  (I think that vim also reads .exrc but if not you will
need to put it in ~/.vimrc if you are using vim.  Beware that typing
"vi" on many modern systems actually gets you vim.)  It is beyond
my exrc-foo to know how to do this only for .py files.

If you like indentation other than 4, then change the 4s, but leave ts
set to 8 (matches the python interpreter's opinion about how offen
there are tab stops in the ASCII sense).

The exception is if you have an existing file that you want to fix in which
tab characters were inserted by an editor that assumes that they mean
something other than 8 columns.  For example, Micro$oft tools seem
often to be set to use the tab character to represent 4 columns.  In this
case, start vi(m), set most of the settings above, but set ts to the value
used in that file (e.g. ts=4), then read in the file (:e filename), change
ts to 8, do any editing you want to do, and write it back out.  This, during
the read of the file, converts any tab characters into enough spaces to
reach the next multiple of ts columns.

Bill

On Thu, May 13, 2010 at 10:10 AM, Jirka Vejrazka
<jirka.vejra...@gmail.com> wrote:
> Ravi,
>
>  the "default" lines where you just uncommented existing lines (like
> the "include admin") start with spaces, the lines you've created start
> with Tab characters. Mixing tabs and spaces is not a good practice
> (generally, it's recommended to use spaces only).
>
>  If you swich your editor to "display special characters" or similar
> (most editors can do that), you'll be able to see it yourself.
>
>  HTH
>
>    Jirka
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to