Heroku deployment internal server error

血红的双手。 提交于 2019-12-24 14:26:30

问题


I've just deployed to heroku for the first time (with a python 3 runtime) based on the cookiecutter-django template (pretty much empty for now to test deployment).

However after first deployment I get an internal server error.
Looking at the logs I see a StringIO error but not sure if this is the original error or just a red herring?

$ heroku logs --app randomapp13
2015-08-28T14:11:40.800277+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/backends/django.py", line 74, in render
2015-08-28T14:11:40.800278+00:00 app[web.1]:     return self.template.render(context)
2015-08-28T14:11:40.800279+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 209, in render
2015-08-28T14:11:40.800280+00:00 app[web.1]:     return self._render(context)
2015-08-28T14:11:40.800283+00:00 app[web.1]:     return self.nodelist.render(context)
2015-08-28T14:11:40.800282+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 201, in _render
2015-08-28T14:11:40.800285+00:00 app[web.1]:     bit = self.render_node(node, context)
2015-08-28T14:11:40.800286+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 917, in render_node
2015-08-28T14:11:40.800288+00:00 app[web.1]:     return node.render(context)
2015-08-28T14:11:40.800289+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/loader_tags.py", line 135, in render
2015-08-28T14:11:40.800290+00:00 app[web.1]:     return compiled_parent._render(context)
2015-08-28T14:11:40.800291+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 201, in _render
2015-08-28T14:11:40.800292+00:00 app[web.1]:     return self.nodelist.render(context)
2015-08-28T14:11:40.800284+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 903, in render
2015-08-28T14:11:40.800296+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 917, in render_node
2015-08-28T14:11:40.800297+00:00 app[web.1]:     return node.render(context)
2015-08-28T14:11:40.800298+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/loader_tags.py", line 65, in render
2015-08-28T14:11:40.800299+00:00 app[web.1]:     result = block.nodelist.render(context)
2015-08-28T14:11:40.800301+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 903, in render
2015-08-28T14:11:40.800294+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 903, in render
2015-08-28T14:11:40.800295+00:00 app[web.1]:     bit = self.render_node(node, context)
2015-08-28T14:11:40.800304+00:00 app[web.1]:     return node.render(context)
2015-08-28T14:11:40.800305+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/templatetags/static.py", line 105, in render
2015-08-28T14:11:40.800306+00:00 app[web.1]:     url = self.url(context)
2015-08-28T14:11:40.800302+00:00 app[web.1]:     bit = self.render_node(node, context)
2015-08-28T14:11:40.800303+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/template/base.py", line 917, in render_node
2015-08-28T14:11:40.800308+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py", line 16, in url
2015-08-28T14:11:40.800309+00:00 app[web.1]:     return static(path)
2015-08-28T14:11:40.800310+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py", line 9, in static
2015-08-28T14:11:40.800311+00:00 app[web.1]:     return staticfiles_storage.url(path)
2015-08-28T14:11:40.800312+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 131, in url
2015-08-28T14:11:40.800313+00:00 app[web.1]:     hashed_name = self.stored_name(clean_name)
2015-08-28T14:11:40.800315+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 280, in stored_name
2015-08-28T14:11:40.800316+00:00 app[web.1]:     cache_name = self.clean_name(self.hashed_name(name))
2015-08-28T14:11:40.800322+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 94, in hashed_name
2015-08-28T14:11:40.800325+00:00 app[web.1]: ValueError: The file 'css/project.css' could not be found with <whitenoise.django.GzipManifestStaticFilesStorage object at 0x7f62a38f76d8>.
2015-08-28T14:11:40.800323+00:00 app[web.1]:     (clean_name, self))
2015-08-28T14:11:40.800326+00:00 app[web.1]: 
2015-08-28T14:11:40.800327+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2015-08-28T14:11:40.800331+00:00 app[web.1]:     from cStringIO import StringIO
2015-08-28T14:11:40.800332+00:00 app[web.1]: ImportError: No module named 'cStringIO'
2015-08-28T14:11:40.800328+00:00 app[web.1]: 
2015-08-28T14:11:40.800329+00:00 app[web.1]: Traceback (most recent call last):
2015-08-28T14:11:40.800360+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/workers/sync.py", line 171, in handle_request
2015-08-28T14:11:40.800330+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django_mailgun/__init__.py", line 7, in <module>
2015-08-28T14:11:40.800361+00:00 app[web.1]:     respiter = self.wsgi(environ, resp.start_response)
2015-08-28T14:11:40.800362+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/whitenoise/base.py", line 119, in __call__
2015-08-28T14:11:40.800363+00:00 app[web.1]:     return self.application(environ, start_response)
2015-08-28T14:11:40.800336+00:00 app[web.1]: 
2015-08-28T14:11:40.800335+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2015-08-28T14:11:40.800337+00:00 app[web.1]: Traceback (most recent call last):
2015-08-28T14:11:40.800338+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/workers/sync.py", line 130, in handle
2015-08-28T14:11:40.800358+00:00 app[web.1]:     self.handle_request(listener, req, client, addr)
2015-08-28T14:11:40.800333+00:00 app[web.1]: 
2015-08-28T14:11:40.800365+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
2015-08-28T14:11:40.800374+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/logging/__init__.py", line 1303, in error
2015-08-28T14:11:40.800367+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/core/handlers/base.py", line 175, in get_response
2015-08-28T14:11:40.800366+00:00 app[web.1]:     response = self.get_response(request)
2015-08-28T14:11:40.800368+00:00 app[web.1]:     response = self.get_exception_response(request, resolver, 404)
2015-08-28T14:11:40.800369+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/core/handlers/base.py", line 90, in get_exception_response
2015-08-28T14:11:40.800371+00:00 app[web.1]:     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
2015-08-28T14:11:40.800372+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/core/handlers/base.py", line 256, in handle_uncaught_exception
2015-08-28T14:11:40.800373+00:00 app[web.1]:     'request': request
2015-08-28T14:11:40.800379+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/logging/__init__.py", line 1419, in handle
2015-08-28T14:11:40.800378+00:00 app[web.1]:     self.handle(record)
2015-08-28T14:11:40.800380+00:00 app[web.1]:     self.callHandlers(record)
2015-08-28T14:11:40.800381+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/logging/__init__.py", line 1481, in callHandlers
2015-08-28T14:11:40.800377+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/logging/__init__.py", line 1409, in _log
2015-08-28T14:11:40.800376+00:00 app[web.1]:     self._log(ERROR, msg, args, **kwargs)
2015-08-28T14:11:40.800386+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/log.py", line 129, in emit
2015-08-28T14:11:40.800382+00:00 app[web.1]:     hdlr.handle(record)
2015-08-28T14:11:40.800384+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/logging/__init__.py", line 853, in handle
2015-08-28T14:11:40.800385+00:00 app[web.1]:     self.emit(record)
2015-08-28T14:11:40.800388+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/log.py", line 132, in send_mail
2015-08-28T14:11:40.800387+00:00 app[web.1]:     self.send_mail(subject, message, fail_silently=True, html_message=html_message)
2015-08-28T14:11:40.800392+00:00 app[web.1]:     return get_connection(backend=self.email_backend, fail_silently=True)
2015-08-28T14:11:40.800391+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/log.py", line 135, in connection
2015-08-28T14:11:40.800389+00:00 app[web.1]:     mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
2015-08-28T14:11:40.800393+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/core/mail/__init__.py", line 37, in get_connection
2015-08-28T14:11:40.800395+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/module_loading.py", line 26, in import_string
2015-08-28T14:11:40.800394+00:00 app[web.1]:     klass = import_string(backend or settings.EMAIL_BACKEND)
2015-08-28T14:11:40.800396+00:00 app[web.1]:     module = import_module(module_path)
2015-08-28T14:11:40.800397+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/importlib/__init__.py", line 109, in import_module
2015-08-28T14:11:40.800401+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2015-08-28T14:11:40.800402+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2015-08-28T14:11:40.800400+00:00 app[web.1]:     return _bootstrap._gcd_import(name[level:], package, level)
2015-08-28T14:11:40.800403+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
2015-08-28T14:11:40.800405+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
2015-08-28T14:11:40.800406+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1129, in _exec
2015-08-28T14:11:40.800407+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 1471, in exec_module
2015-08-28T14:11:40.800408+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
2015-08-28T14:11:40.800409+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.4/site-packages/django_mailgun/__init__.py", line 9, in <module>
2015-08-28T14:11:40.800410+00:00 app[web.1]:     from StringIO import StringIO
2015-08-28T14:11:40.800415+00:00 app[web.1]: ImportError: No module named 'StringIO'
2015-08-28T14:11:51+00:00 app[heroku-redis]: source=REDIS sample#active-connections=1 sample#load-avg-1m=0.225 sample#load-avg-5m=0.27 sample#load-avg-15m=0.27 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15405660kB sample#memory-free=258180kB sample#memory-cached=13597460kB sample#memory-redis=294048bytes
2015-08-28T14:12:35+00:00 app[heroku-redis]: source=REDIS sample#active-connections=1 sample#load-avg-1m=0.185 sample#load-avg-5m=0.255 sample#load-avg-15m=0.265 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15405660kB sample#memory-free=253676kB sample#memory-cached=13600464kB sample#memory-redis=294048bytes
2015-08-28T14:13:47+00:00 app[heroku-redis]: source=REDIS sample#active-connections=1 sample#load-avg-1m=0.16 sample#load-avg-5m=0.23 sample#load-avg-15m=0.255 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15405660kB sample#memory-free=255032kB sample#memory-cached=13599296kB sample#memory-redis=294048bytes
2015-08-28T14:14:56+00:00 app[heroku-redis]: source=REDIS sample#active-connections=1 sample#load-avg-1m=0.185 sample#load-avg-5m=0.225 sample#load-avg-15m=0.25 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15405660kB sample#memory-free=248304kB sample#memory-cached=13602396kB sample#memory-redis=294048bytes
2015-08-28T14:16:09+00:00 app[heroku-redis]: source=REDIS sample#active-connections=1 sample#load-avg-1m=0.28 sample#load-avg-5m=0.245 sample#load-avg-15m=0.255 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15405660kB sample#memory-free=245148kB sample#memory-cached=13605792kB sample#memory-redis=294048bytes
2015-08-28T14:16:54+00:00 app[heroku-redis]: source=REDIS sample#active-connections=1 sample#load-avg-1m=0.175 sample#load-avg-5m=0.225 sample#load-avg-15m=0.245 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15405660kB sample#memory-free=246320kB sample#memory-cached=13607440kB sample#memory-redis=294048bytes
2015-08-28T14:18:04+00:00 app[heroku-redis]: source=REDIS sample#active-connections=1 sample#load-avg-1m=0.27 sample#load-avg-5m=0.245 sample#load-avg-15m=0.25 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15405660kB sample#memory-free=240692kB sample#memory-cached=13610804kB sample#memory-redis=294048bytes

回答1:


The version of django_mailgun you have installed is incompatible with Python 3 (see this issue).

The problem is fixed in the latest version, currently 0.7.0.



来源:https://stackoverflow.com/questions/32273687/heroku-deployment-internal-server-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!