社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  问与答

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

yicaiziya • 8 年前 • 7963 次点击  

以下为我运行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
 
7963 次点击  
文章 [ 1 ]  |  最新文章 8 年前
曾哥
Reply   •   1 楼
曾哥    8 年前

DJANGO_SETTINGS_MODULE="settings"