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

469 views
Skip to first unread message

Django_for_SB

unread,
Feb 21, 2012, 6:41:01 PM2/21/12
to Django users
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

Furbee

unread,
Feb 21, 2012, 8:12:43 PM2/21/12
to django...@googlegroups.com
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


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


kalyani ram

unread,
Feb 22, 2012, 12:03:02 AM2/22/12
to Django users
Hey I am a begginer too and i went tru the same tutorial and trust me
i had so many errors and i just struggled tru..
now indentation errors are quite common. what u need to do is, go to u
models.py, admin.py, views.py or any other .py file for which ever the
code is written, and plz try using python editor to write instead of
other text editors. they help u indent the code pretty well. and then
give python manage.py shell after syncdb n validate.
I am sure u ll get tru. indent your functions properly.
all the best.


Regards,
kalyani Ram

Bill Freeman

unread,
Feb 22, 2012, 12:19:03 PM2/22/12
to django...@googlegroups.com
1. There is more information in that traceback (that you didn't
include) that could help
you find your indentation error.

2. It is quite useful, presuming that you are also a python beginner,
to do the tutorial
at:

http://docs.python.org/tutorial/index.html

Bill

Sami Balbaky

unread,
Feb 27, 2012, 5:39:04 PM2/27/12
to django...@googlegroups.com
Thanks everyone. Your inputs were a tremendous help. I'm slowly, but surely, getting the hang of Django.

Best,

S
Reply all
Reply to author
Forward
0 new messages