总结一个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)



猜你喜欢

转载自www.cnblogs.com/lzh-engine/p/9034723.html
今日推荐