[英]When i execute unittest command “python3 -m unittest filepath/filename.py” it showing improperly configured error
When I execute the unit test command: python3 -m unittest filepath/filename.py
it throws an improperly configured error, could anyone help with this, it would be much appreciated当我执行单元测试命令时: python3 -m unittest filepath/filename.py
它会抛出一个配置不正确的错误,任何人都可以帮助解决这个问题,将不胜感激
Error:错误:
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but
settings are not configured. You must either define the environment variable
DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
You need to set which settings file you need to run the unit test.您需要设置运行单元测试所需的设置文件。
on Linux在 Linux
$ export DJANGO_SETTINGS_MODULE=your_setting
please read this https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#testing-other-python-versions-and-database-backends请阅读此https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#testing-other-python-versions-and-database-backends
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.