This project has moved and is read-only. For the latest updates, please go here.

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\", line 1, in <module>
    from django.db import models
  File "C:\Python27\lib\site-packages\django\db\", line 11, in <module>
    if DEFAULT_DB_ALIAS not in settings.DATABASES:
  File "C:\Python27\lib\site-packages\django\utils\", line 184, in inner
  File "C:\Python27\lib\site-packages\django\conf\", 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 commands from within the shell in Visual Studio using the following syntax, for example:
>>> import os
>>> os.system('python sql projects')
Once this is done, a simple right-click on the project, click Django Sync DB, and you have your database.