Wednesday, December 26, 2012

Re: Stuck

This is strange - the original code is indented correctly; however, the copy/paste shows incorrect indentation. I would have noticed something THAT obvious. The misspelling is legit, but what was wrong was that I had two files named"polls," which confused everything. 

On Wednesday, December 26, 2012 2:22:40 PM UTC-5, rktu...@gmail.com wrote:
I'll keep this as short as possible. When I input  python manage.py sql polls, i get the following error:
 
C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py sql pol
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py
443, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py
382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", l
 in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", l
 in execute
    self.validate()
  File "C:\Python27\lib\site-packages\django\core\management\base.py", l
 in validate
    num_errors = get_validation_errors(s, app)
  File "C:\Python27\lib\site-packages\django\core\management\validation.
e 30, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
 get_app_errors
    self._populate()
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
_populate
    self.load_app(app_name, True)
  File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
load_app
    models = import_module('.models', app_name)
  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 3
port_module
    __import__(name)
  File "C:\Python27\Lib\site-packages\django\bin\mysite\polls\models.py"
0
    votes = models.IntergerField()
                                 ^
IndentationError: unindent does not match any outer indentation level

So here is my settings.py "Installed apps" 

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
'polls',
)

And here is my models.py:

from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
    votes = models.IntergerField()

I am running python 2.7 and Django 1.4.3 on Windows 8
Thanks!!!!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/_tb9n3Oq35wJ.
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