我试图使用Django Heroku所有必要的依赖项来创建我的应用程序 .
执行以下步骤后:
migrating an existing django project
但是当我运行 python3 manage.py runserver
时,我一直收到此错误:
import dj_database_url ImportError:没有名为'dj_database_url'的模块
我试图用these instructions和this修复它
这是我的代码:
我导入了dj-database-url
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
我添加了以下STATIC资产必需品
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
这是在我的requirements.txt文件中
dj-database-url == 0.4.2 gunicorn == 19.7.1 whitenoise == 3.3.0
我仍然得到 ImportError
. 我该如何解决?
1 回答
你用类似的东西安装了库吗?
要么
要么
?