Py学习  »  问与答

关于environment variable DJANGO_SETTINGS_MODULE 这个环境变量的问题

yicaiziya • 8 年前 • 8052 次点击  

以下为我运行models.py报错的详情 Traceback (most recent call last): File "D:/projects/mysite/polls/models.py", line 6, in <module> class Question(models.Model): File "D:/projects/mysite/polls/models.py", line 7, in Question question_text = models.CharField(max_length=200) File "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\django\db\models\fields__init.py", line 1081, in init super(CharField, self).init(args, *kwargs) File "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\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-1.8.4-py2.7.egg\django\conf__init.py", line 48, in getattr self._setup(name) File "C:\Python27\lib\site-packages\django-1.8.4-py2.7.egg\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.

怎么解决? 求大神帮助解答!

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1537
 
8052 次点击  
文章 [ 1 ]  |  最新文章 8 年前