2017-10-12 89 views
2

當我添加「頻道」到INSTALLED_APPS推到Heroku的:沒有名爲「頻道」

Writing objects: 100% (4/4), 351 bytes | 0 bytes/s, done. 
Total 4 (delta 3), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Python app detected 
remote: -----> Installing requirements with latest Pipenv… 
remote:  Installing dependencies from Pipfile.lock (36121f)… 
remote: -----> $ python manage.py collectstatic --noinput 
remote:  Traceback (most recent call last): 
remote:   File "manage.py", line 10, in <module> 
remote:   execute_from_command_line(sys.argv) 
remote:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line 
remote:   utility.execute() 
remote:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute 
remote:   django.setup() 
remote:   File "/app/.heroku/python/lib/python3.6/site- packages/django/__init__.py", line 27, in setup 
remote:   apps.populate(settings.INSTALLED_APPS) 
remote:   File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate 
remote:   app_config = AppConfig.create(entry) 
remote:   File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/config.py", line 94, in create 
remote:   module = import_module(entry) 
remote:   File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module 
remote:   return _bootstrap._gcd_import(name[level:], package, level) 
remote:   File "<frozen importlib._bootstrap>", line 978, in _gcd_import 
remote:   File "<frozen importlib._bootstrap>", line 961, in _find_and_load 
remote:   File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked 
remote:  ModuleNotFoundError: No module named 'channels' 
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  

有什麼我試過到目前爲止我面對這個錯誤模塊:

我禁用collectstatic它能夠將代碼推送到Heroku的,但服務器死機

卸載通道和安裝再次

誰能給我一些建議,謝謝。

+0

是因爲你的requirements.txt?顯示該文件。 –

+0

我在requirements.txt中找到它,列表如下 asgi-redis == 1.4.3 asgiref == 1.1.2 astroid == 1.5.3 attrs == 17.2。0 高速公路== 17.9.3 自動售貨機== 0.6.0 CERTIFI == 2017.7.27.1 通道== 1.1.8 chardet的== 3.0.4 COLORAMA == 0.3.9 不斷== 15.1.0 達芙妮== 1.3.0 裝飾== 4.1.2 DJ-數據庫URL == 0.4.2 Django的== 1.11.6 flake8 == 3.4.1 超級鏈接== 17.3.1 IDNA == 2.6 增量== 17.5.0 IPython的== 6.2.1 IPython的-genutils == 0.2.0 isort == 4.2.15 絕== 0.11.0 懶惰對象代理== 1.3.1 – Kaspar

+0

對不清楚的格式....請參閱下面 ![Valid XHTML](https://imgur.com/a/kbHIO)。 – Kaspar

回答

1

我有同樣的問題。問題是由於我用django頻道(也有django_channels)而不是頻道

django頻道的正確套裝實際上是頻道

因此,只要做到這一點:

  1. 列出所有已安裝的軟件包與通道有名稱

PIP列表 | grep的通道

輸出:

通道(1.1.6)

通道-API(0.4.0)

django的通道(0.7.0)

  1. 使用pip uninstall package-name卸載它們中的每一個(偶數通道): 例如:畫中畫卸載django的通道
  2. 重新安裝僅信道(巫稱爲通道'django的通道' 或 'django_channels')封裝使用:

PIP安裝通道

  • 創建requirements.txt使用:
  • PIP凍結> requirements.txt

    +0

    感謝您的回覆,沒有其他套餐關聯頻道.. 我跟着heroku入門公會,還沒有安裝其他套餐。所以我很困惑發生了什麼...... – Kaspar