总结一个pycharm中运行不了django程序的解决办法

看错误是: django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MOD

百度了下,效果都不太好,最后找到的解决办法如下:

1.在需要执行的程序中添加:

import django
django.setup()

2.在pycharm的设置中设置settings路径即可(app.settings)

 

 

 

 



 

posted @ 2018-05-14 10:07  wind1990  阅读(6238)  评论(0编辑  收藏  举报