首页 > IT职业 > IT生活 > 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)

更多Python知识,请点击Python视频教程!!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/818/viewspace-2833013/ ,如需转载,请注明出处,否则将追究法律责任。