from django.db import models
# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('data publikacji')
def __unicode__(self):
return(self.question)
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return(self.choice)
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\django\conf\__init__.py", line 37, in _setup
settings_module = os.environ[ENVIRONMENT_VARIABLE]
File "C:\Python33\lib\os.py", line 672, in __getitem__
value = self._data[self.encodekey(key)]
KeyError: 'DJANGO_SETTINGS_MODULE'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\Scripts\asd\dzialy\models.py", line 1, in <module>
from django.db import models
File "C:\Python33\lib\site-packages\django\db\__init__.py", line 11, in <module>
if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
File "C:\Python33\lib\site-packages\django\conf\__init__.py", line 53, in __getattr__
self._setup(name)
File "C:\Python33\lib\site-packages\django\conf\__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.