Error adding data via shell

Feb 4, 2013 at 4:12 PM
I'm trying to add some data to my SQLite db via the Python 2.7 interactive shell. Any thoughts on why I am getting the following?
>>> from ProjectTrackerServer.projects.models import Project
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\djangoapps\ProjectTrackerServer\ProjectTrackerServer\projects\models.py", line 1, in <module>
    from django.db import models
  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 11, in <module>
    if DEFAULT_DB_ALIAS not in settings.DATABASES:
  File "C:\Python27\lib\site-packages\django\utils\functional.py", line 184, in inner
    self._setup()
  File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 40, in _setup
    raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
Feb 4, 2013 at 9:21 PM
Seems my database wasn't synced properly. For those who are not aware, you can use manage.py commands from within the shell in Visual Studio using the following syntax, for example:
>>> import os
>>> os.system('python manage.py sql projects')
Once this is done, a simple right-click on the project, click Django Sync DB, and you have your database.