问题描述
尝试运行django项目,安装了requirements.txt中的所有内容,但仍然出现错误
Trying to run django project, installed all stuff from requirements.txt but still getting error
from django.contrib.admin import ModelAdmin, actions
ImportError: cannot import name actions
找不到任何有用的信息.有人知道如何解决吗?
Can't find anything useful about it. Does anybody know how to fix it?
更新:
我发现这里没有settings.py文件,但是有settings文件夹而不是它,它包含common.py和production.py,也没有settings.py.可能就是这个问题吗?
I've found that there is no settings.py file but settings folder instead of it and it contains common.py and production.py and no settings.py. May be that's the problem?
推荐答案
我试图像这样在python shell中手动运行导入:
I've tried to run import manually in python shell like this:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chipped.settings.common")
from django.contrib.admin import ModelAdmin, actions
它告诉我没有 postgresql_psycopg2
模块.我将数据库引擎更改为 django.db.backends.sqlite3
,现在可以使用了.
And it told me that there is no postgresql_psycopg2
module. I changed database engine to django.db.backends.sqlite3
and now it works.
这篇关于ImportError:无法导入名称操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!