导入错误:在 Heroku 上部署时没有名为“解耦”的模块

2024-02-24

我试图从heroku cli 在heroku 上部署我的django 项目。所以我创建了一个应用程序然后运行git push heroku master从项目目录。然后我得到了错误:

remote: -----> $ python manage.py collectstatic --noinput 
remote:      Traceback (most recent call last): 
remote:          File "manage.py", line 15, in <module> 
remote:            execute_from_command_line(sys.argv) 
remote:          File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line 
remote:            utility.execute() 
remote:          File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 317, in execute 
remote:            settings.INSTALLED_APPS 
remote:          File "/app/.heroku/python/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__ 
remote:            self._setup(name) 
remote:   File "/app/.heroku/python/lib/python3.5/site-packages/django/conf/__init__.py", line 43, in _setup remote:            self._wrapped = Settings(settings_module) 
remote:          File "/app/.heroku/python/lib/python3.5/site-packages/django/conf/__init__.py", line 106, in __init__ 
remote:            mod = importlib.import_module(self.SETTINGS_MODULE) 
remote:          File "/app/.heroku/python/lib/python3.5/importlib/__init__.py", line 126, in import_module 
remote:            return _bootstrap._gcd_import(name[level:], package, level) 
remote:          File "<frozen importlib._bootstrap>", line 986, in _gcd_import 
remote: File "<frozen importlib._bootstrap>", line 969, in _find_and_load 
remote:          File "<frozen importlib._bootstrap>", line 958, in
_find_and_load_unlocked 
remote:          File "<frozen importlib._bootstrap>", line 673, in _load_unlocked 
remote:          File "<frozen importlib._bootstrap_external>", line 665, in exec_module 
remote:          File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed 
remote:          File "/tmp/build_93c58c906371cd0110470b6bb3ccecc1/funderpreneur/settings.py", line 15, in <module> 
remote:            from decouple import Csv, config 
remote:        ImportError: No module named 'decouple' 
remote:  
remote:  !     Error while running '$ python manage.py collectstatic --noinput'. 
remote:        See traceback above for details. 
remote:  
remote:        You may need to update application code to resolve this error. 
remote:        Or, you can disable collectstatic for this application: remote:  
remote:           $ heroku config:set DISABLE_COLLECTSTATIC=1 
remote:  
remote:        https://devcenter.heroku.com/articles/django-assets 
remote:  !     Push rejected, failed to compile Python app. 
remote:  
remote:  !     Push failed

正如所提到的,我跑了heroku config:set DISABLE_COLLECTSTATIC=1。 然后代码被推送到存储库中。然后我跑了heroku run python3 manage.py migrate。但我仍然遇到同样的错误:

文件“/app/funderpreneur/settings.py”,第 15 行,位于

来自解耦导入 Csv,配置导入错误:没有名为“解耦”的模块

但我有python 解耦python 2 和 3 都在本地安装。整个项目也在 django 版本 2 和 python 版本 3.5.2 上运行。但在runtime.txt我已经设定python-3.6.4。我有requirements.txt where decouple已经在那里了。

In my settings.py I had

import django_heroku
django_heroku.settings(locals())

但我遇到了错误,所以我对它们进行了评论。仍然出现错误。

出了什么问题或者我做错了什么?

Edit

My requirements.txt:

dj-database-url
django
gunicorn
psycopg2
whitenoise
dj-static
Unipath
python-decouple
Pillow
Markdown
bleach
python-decouple
django-material
raven
django-debug-toolbar
django-tables2
django-phonenumber-field
django-guardian
django-notifications-hq
djangorestframework
matplotlib
numpy
seaborn
pandas
django-heroku

结构是:

.
├── core
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── __init__.py
│   │   └── __pycache__
│   │       └── __init__.cpython-35.pyc
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-35.pyc
│   │   ├── __init__.cpython-35.pyc
│   │   ├── models.cpython-35.pyc
│   │   └── views.cpython-35.pyc
│   ├── templates
│   │   └── core
│   │       ├── base.html
│   │       ├── footer.html
│   │       ├── index.html
│   │       ├── login.html
│   │       ├── navbar.html
│   │       ├── nav.html
│   │       ├── partial_settings_menu.html
│   │       ├── password.html
│   │       ├── picture.html
│   │       ├── profile.html
│   │       └── registration.html
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── db.sqlite3
├── funderpreneur
│   ├── fonts
│   │   ├── material-design-icons
│   │   │   ├── Material-Design-Iconsd41d.eot
│   │   │   ├── Material-Design-Icons.svg
│   │   │   ├── Material-Design-Icons.ttf
│   │   │   └── Material-Design-Icons.woff
│   │   └── roboto
│   │       ├── Roboto-Bold.ttf
│   │       ├── Roboto-Bold.woff
│   │       ├── Roboto-Light.ttf
│   │       ├── Roboto-Light.woff
│   │       ├── Roboto-Medium.ttf
│   │       ├── Roboto-Medium.woff
│   │       ├── Roboto-Regular.ttf
│   │       ├── Roboto-Regular.woff
│   │       ├── Roboto-Thin.ttf
│   │       └── Roboto-Thin.woff
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-35.pyc
│   │   ├── settings.cpython-35.pyc
│   │   ├── urls.cpython-35.pyc
│   │   └── wsgi.cpython-35.pyc
│   ├── settings.py
│   ├── static
│   │   ├── css
│   │   │   ├── account-settings.css
│   │   │   ├── bootstrap.min.css
│   │   │   ├── custom-materialize.css
│   │   │   ├── footer.css
│   │   │   ├── high-rise-building.jpg
│   │   │   ├── materialize.css
│   │   │   ├── navbar.css
│   │   │   ├── navbar-top-fixed.css
│   │   │   ├── style2.css
│   │   │   └── style.css
│   │   ├── humans.txt
│   │   ├── img
│   │   │   └── buet_logo.png
│   │   └── js
│   │       ├── bootstrap.min.js
│   │       ├── circular-progress-jquery.js
│   │       ├── jquery-1.11.2.min.js
│   │       ├── jquery-slim.min.js
│   │       ├── jquery.waypoints.min.js
│   │       ├── materialize.js
│   │       ├── popper.min.js
│   │       ├── profile-validation.js
│   │       └── registration-validation.js
│   ├── urls.py
│   └── wsgi.py
├── manage.py
├── media
├── Pipfile
├── Procfile
├── README.md
├── requirements.txt
├── runtime.txt
└── staticfiles

我也遇到了这个问题,但是通过添加

python-decouple==3.1

进入requirements.txt文件,我能够通过它!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

导入错误:在 Heroku 上部署时没有名为“解耦”的模块 的相关文章

随机推荐

  • 在派生抽象类中强制执行事件

    我正在尝试创建我所认为的翻译类 以便我的程序可以与各种目标平台对话 每个平台都将由抽象类的单独实现来处理 为了简单起见 我已经削减了一些内容 我有一个抽象类 有几个抽象方法 abstract class ControllerBase pub
  • 如何使用 RefCursor 返回类型测试 Oracle 存储过程?

    我正在寻找有关如何在 SQL Developer 或 Embarcardero Rapid XE2 中测试 Oracle 存储过程的良好解释 谢谢 就像是 create or replace procedure my proc p rc O
  • Quartz.net 中每次执行后 JobData 不会持久化

    我有一份工作想要跟踪 50 次最新运行 由于某种原因 状态似乎没有存储在我的简单原型中 PersistJobDataAfterExecution public class ApiJob IJob private const string J
  • 使用 jsTree 进行延迟加载

    我试图在 jtree 扩展时动态加载它们的节点 我发现的小文档位于末尾这一页 http www jstree com docs json 我找到了一些解决方案 可以使用类似的循环逐一创建节点this one https stackoverf
  • 冬眠,偷懒还是不偷懒? [关闭]

    Closed 这个问题是基于意见的 help closed questions 目前不接受答案 I have entity A 与多对多关系entity B 所以表格布局是 A AB mapping table B 获取实体A的对象 我打电
  • 仅当使用reactJS 城市名称不匹配时才显示错误消息

    我有一个搜索框 当用户输入 5 个或更多字符时 它应该在搜索框中显示完整地址 IT 工作正常 但现在的问题是当城市名称不匹配时 它应该显示错误消息 问题是 匹配的城市名称和不匹配的城市都显示错误消息 我该如何解决这个问题 请问有人可以帮我吗
  • 为什么在删除实体时会出现 StaleObjectStateException?

    在我的 Spring Boot Web 应用程序中 我有一个控制器 它提供了一种从数据库中删除实体的方法 该方法又调用 DAO 类 然而 当我打电话时entityManager remove entity 我收到一个StaleObjectS
  • SQL Server ON DELETE 触发器

    我正在尝试创建一个基本数据库触发器 当删除database2 table2 中的行时 该触发器有条件地从database1 table1 中删除行 我是触发器新手 希望学习实现此目标的最佳方法 这是我到目前为止所拥有的 建议 CREATE
  • 如何使用 GDB 调试共享对象库中的函数?

    我正在尝试验证共享对象库中函数的功能 在带有main函数 我会简单地start程序和 gdb 会自动在 main 上设置断点 但这显然在这里不可用 假设我有一些add c long add long x long y return x y
  • 在 Xamarin.Forms 中处理 Android 推送通知操作

    所以我只是在我的 Xamarin Forms Android 应用程序中实现了 FCM本指南 https learn microsoft com en us azure app service mobile app service mobi
  • 写“::namespace::identifier”和“namespace::identifier”有什么区别?

    我在代码中看到了这两种方法 您能解释一下两者之间有什么区别吗 我认为它与 C 完成名称空间查找的方式有关 您能否也提供一些有关此的信息 或者可能是一个好的文档的链接 谢谢 Example include
  • Is-大括号-可构造类型特征

    如何检查是否特定类型typename T可以从参数构造typename Args以这样的方式T Args 我知道std is constructible lt T Args gt 类型特征来自
  • 多行引导行

    我希望表单字段在台式机和平板电脑上的放置方式不同 目前 桌面上一切都很好 我身边有两个类似的案例 在第一个中 我有这样的内容 输入字段位于 div 中 div class row div class col md 3 col sm 6 di
  • ZF2:模块无法初始化

    我正在尝试开始使用 ZF2 但在编写教程 在 ZF 网站上 中的代码时遇到问题 我的代码 Module php
  • 如何使用 Android 版 Google Places API 获取 opening_hours

    我正在与适用于 Android 的 Google 地方信息 API https developers google com places android api 我想访问营业时间信息 我已经搜索并在Google Places API 网络服
  • 使用 boost::shared_ptr 有哪些潜在危险?

    使用时有哪些方式可能会搬起石头砸自己的脚boost shared ptr http www boost org doc libs release libs smart ptr shared ptr htm 换句话说 我在使用时要避免哪些陷阱
  • 在 Google Charts 中包含带有 MathJax 的 LaTeX 符号?

    在生成的树形图中谷歌图表 https developers google com chart interactive docs gallery orgchart我想包含使用 MathJax 生成的 LaTeX 符号 使用通常在 HTML 文
  • Keras 的 OrderedEnqueuer 是否保证了批次的顺序?

    我有一个习惯keras utils sequence它以特定 且关键 的顺序生成批次 但是 我需要跨多个核心并行化批量生成 名字是不是 OrderedEnqueuer 意味着结果队列中批次的顺序保证与原始队列的顺序相同keras utils
  • Jupyterlab 最小化导航窗格

    在 JupyterLab 中 屏幕左侧的导航窗格非常有用 但占用了大量空间 有没有办法隐藏它 以便我们可以使用导航器窗口的整个宽度查看笔记本 我自己的问题的答案是 您只需单击 文件 垂直选项卡即可 此操作会切换导航窗格
  • 导入错误:在 Heroku 上部署时没有名为“解耦”的模块

    我试图从heroku cli 在heroku 上部署我的django 项目 所以我创建了一个应用程序然后运行git push heroku master从项目目录 然后我得到了错误 remote gt python manage py co