看错误是: 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)