由于django_comments,将应用程序推送到Heroku失败了

时间:2016-05-25 07:28:41

标签: python django heroku django-comments

我试图将我的项目推送到Heroku但它失败了,因为我找不到django_comments。这是我的日志:

-----> Using set buildpack heroku/python
-----> Python app detected
     $ pip install -r requirements.txt
     $ python manage.py collectstatic --noinput
       Traceback (most recent call last):
         File "manage.py", line 10, in <module>
           execute_from_command_line(sys.argv)
         File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
           utility.execute()
         File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
           django.setup()
         File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
           apps.populate(settings.INSTALLED_APPS)
         File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
           app_config = AppConfig.create(entry)
         File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
           module = import_module(entry)
         File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
           __import__(name)
       ImportError: No module named django_comments
 !     Error while running '$ python manage.py collectstatic --noinput'.
       See traceback above for details.
       You may need to update application code to resolve this error.
       Or, you can disable collectstatic for this application:
          $ heroku config:set DISABLE_COLLECTSTATIC=1
       https://devcenter.heroku.com/articles/django-assets
****** Collectstatic environment variables:
       CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/vendor/include:/app/.heroku/python/include:
       SOURCE_VERSION=9698848ab6d9bab7f8c8e2181eb933f2619341e9
       PROFILE_PATH=/app/.profile.d/python.sh
       DEBUG_COLLECTSTATIC=1
       LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/vendor/lib:/app/.heroku/python/lib:
       CACHE_DIR=/app/tmp/cache
       PYTHONUNBUFFERED=1
       HEROKU_POSTGRESQL_AQUA_URL=postgres://wlxiltlrxwplzs:XDQANL2tlH_NdD_P_hUse2juCM@ec2-54-243-201-3.compute-1.amazonaws.com:5432/d6t4rugnogngm3
       PYHONHOME=/app/.heroku/python
       LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/.heroku/vendor/lib:/app/.heroku/python/lib:
       BIN_DIR=/app/tmp/buildpacks/python/bin
       PATH=/app/.heroku/python/bin:/app/.heroku/vendor/bin::/usr/local/bin:/app/bin:/app/vendor/bundle/bin:/app/vendor/bundle/ruby/2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin:/app/tmp/buildpacks/python/vendor/bpwatch:/app/tmp/buildpacks/python/vendor/pip-pop
       RECOMMENDED_PYTHON_VERSION=python-2.7.11
       C_INCLUDE_PATH=/app/.heroku/vendor/include:/app/.heroku/vendor/include:/app/.heroku/python/include:
       ENABLE_COLLECTSTATIC=1
       PWD=/app
       LOG_FILE=/tmp/fifo20160525-3-183u9i6
       LANG=en_US.UTF-8
       STACK=cedar-14
       SHLVL=3
       REQUEST_ID=8504b0c1-bbd2-4360-ae76-7dfc10b78046
       HOME=/app
       BPWATCH_STORE_PATH=/app/tmp/cache/bpwatch.json
       PYTHONPATH=/app/
       BUILD_DIR=/app
       WARNINGS_LOG=/tmp/tmp.IxuQyzgYW1
       HEROKU_POSTGRESQL_NAVY_URL=postgres://ulkvhxkyxdewvx:PsGXzEe3oTDwGHgap5JINYgdpw@ec2-54-243-200-159.compute-1.amazonaws.com:5432/d77uogldogo1op
       USER_LOG_FILE=/tmp/fifo20160525-3-yjcxuf
       PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkgconfig:/app/.heroku/vendor/lib/pkgconfig:/app/.heroku/vendor/lib/pkg-config:/app/.heroku/vendor/lib/pkg-config:/app/.heroku/python/lib/pkg-config:
       DATABASE_URL=postgres://hvjyqvblijhpsk:GX4wjqN8bjSHOvwRB39nayAdZa@ec2-23-21-255-14.compute-1.amazonaws.com:5432/d2j3l0bc45qakf
       _=/usr/bin/env
 !     Push rejected, failed to compile Python app`

这是我的requiremenst.txt

dj-database-url==0.4.0 
Django==1.9.2 
gunicorn==19.4.5 
psycopg2==2.6.1 
whitenoise==2.0.6 

1 个答案:

答案 0 :(得分:1)

django_comments模块的PyPI包名称为django-contrib-comments。将以下行添加到requirements.txt

django-contrib-comments

或具有特定版本号,例如:

django-contrib-comments==1.7.1