Tuesday, February 21, 2012

Re: Calling "manage.py shell" from the Python Shell in Tutorial Part 1

Python is indentation-specific. It determines the semantics of your code by it's levels of indentation. For instance:

# print False
if False:
    print "false"
print "done"

if False:
    print "false"
else:
    print "true"

Note that inside the if block, all lines which are indented belong to that if block. The block ends when the indentation ends. The error "IndentationError: unexpected Indent" tells you that Python got an indentation it was not expecting. This could be as simple as a single space that shouldn't be there. Check your models.py and settings.py files for any lines that are indented which are not supposed to be.

Furbee

On Tue, Feb 21, 2012 at 3:41 PM, Django_for_SB <sami.balbaky@gmail.com> wrote:
Django Gurus,

I'm an absolute beginner using Python in Django. I'm currently going
through the tutorial, part 1, on the djangoproject.com main website:
https://docs.djangoproject.com/en/1.3/intro/tutorial01/. I keep trying
to complete part 1 of the tutorial, step by step, meaning, I'll go
through the tutorial part 1, progress up to a certain point, then
close my shell command and shut-down my computer. Then, when I get
back to opening up the project in which I initially began working on,
namely, "mysite" (as the tutorial instructs us to name), my shell
commands aren't valid anymore.

Example:

manage.py shell                                     -----> This
initially works if I start the project from scratch

manage.py shell                                     -----> This won't
work if I leave my project, then go back to continue to

work on it later

This is the error I keep getting:

Traceback(most recent call last):

IndentationError: unexpected Indent



I'm not quite sure what's going on. Any assistance would be more than
appreciated. What am I missing here? Thank you.

Best,

SB

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

No comments:

Post a Comment