I'm working in Django and I have 2 apps (monitor and maintenance) in a single project. I can't seem to figure out why when one app's models.py is working, the other one doesn't. Here's my debug output, but it doesn't seem to make any sense because I AM setting DJANGO_SETTINGS_MODULE. Both apps worked until I added models to one of them. Then "monitor" died. When I changed the models in monitor, maintenance had this happen.
Debug output:
Connected to pydev debugger (build 139.1659)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.6\helpers\pydev\pydevd.py", line 2217, in <module>
globals = debugger.run(setup['file'], None, None)
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.6\helpers\pydev\pydevd.py", line 1643, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:/REPOS/client-product-controller/Web/myproject/maintenance/views.py", line 4, in <module>
from models import Control
File "C:/REPOS/client-product-controller/Web/myproject/maintenance\models.py", line 5, in <module>
class Control(models.Model):
File "C:/REPOS/client-product-controller/Web/myproject/maintenance\models.py", line 6, in Control
control_label = models.CharField(max_length=200)
File "C:\Python27\lib\site-packages\django\db\models\fields\__init__.py", line 1081, in __init__
super(CharField, self).__init__(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\fields\__init__.py", line 161, in __init__
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__
self._setup(name)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 42, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
here's my wsgi.py
import os
# import pdb; pdb.set_trace()
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
application = get_wsgi_application()
and in my maintenance/views.py
...
from models import Control
..
and in my maintenance/models.py
...
class Control(models.Model):
control_label = models.CharField(max_length=200)
...
I haven't changed any code in maintenance. and the SAME error was happening in monitor just moments ago. I'm not sure what changed, but I did do a migration and syncdb
Aucun commentaire:
Enregistrer un commentaire