Django应用程序在Heroku中崩溃

Django应用程序在Heroku中崩溃

本文介绍了Django应用程序在Heroku中崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在heroku上部署我的第一个django应用程序,并且一直遵循。我一路走到这一步,检查网页进程是否正常,看起来像应用程序崩溃:

I'm trying to deploy my first django app on heroku and have been following the guide on the Heroku site. I get all the way to this step of checking to see if the web process is up and it looks like like the app is crashing:

(venv)Jonathans-MacBook-Air-2:myportfolio jonathanschen$ heroku ps
=== web: `python ./manage.py runserver 0.0.0.0:$PORT --noreload`
web.1: crashed for 2m

当我查看我的日志时,有很多东西。我已经阅读了stackoverflow中的一些不同的帖子,我想知道我是否需要在根目录中有一个proc文件(似乎有冲突的答案)?这可能是导致崩溃的原因吗?一如既往地感谢大量提前的堆栈溢出。这是日志:

When I check my log there's a lot of stuff. I've read some of the different posts on stackoverflow and am wondering whether i need to have a proc file in the root directory (there seems to be conflicting answers)? Could that be whats causing the crash? As always thanks a lot in advance stack overflow. Here is the log:

(venv)Jonathans-MacBook-Air-2:myportfolio jonathanschen$ heroku logs
2012-08-01T18:29:55+00:00 app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
2012-08-01T18:29:55+00:00 app[web.1]:     self.execute(*args, **options.__dict__)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
2012-08-01T18:29:55+00:00 app[web.1]:     output = self.handle(*args, **options)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 69, in handle
2012-08-01T18:29:55+00:00 app[web.1]:     self.run(*args, **options)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 80, in run
2012-08-01T18:29:55+00:00 app[web.1]:     self.inner_run(*args, **options)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
2012-08-01T18:29:55+00:00 app[web.1]:     self.validate(display_num_errors=True)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
2012-08-01T18:29:55+00:00 app[web.1]:     num_errors = get_validation_errors(s, app)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors
2012-08-01T18:29:55+00:00 app[web.1]:     from django.db import models, connection
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
2012-08-01T18:29:55+00:00 app[web.1]:     backend = load_backend(connection.settings_dict['ENGINE'])
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
2012-08-01T18:29:55+00:00 app[web.1]:     return getattr(connections[DEFAULT_DB_ALIAS], item)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
2012-08-01T18:29:55+00:00 app[web.1]:     backend = load_backend(db['ENGINE'])
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 24, in load_backend
2012-08-01T18:29:55+00:00 app[web.1]:     return import_module('.base', backend_name)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 34, in import_module
2012-08-01T18:29:55+00:00 app[web.1]:     name = _resolve_name(name[level:], package, level)
2012-08-01T18:29:55+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 7, in _resolve_name
2012-08-01T18:29:55+00:00 app[web.1]:     raise ValueError("'package' not set to a string")
2012-08-01T18:29:55+00:00 app[web.1]: ValueError: 'package' not set to a string
2012-08-01T18:29:56+00:00 heroku[web.1]: Process exited with status 1
2012-08-01T18:29:56+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-01T18:41:41+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-01T18:41:45+00:00 heroku[web.1]: Starting process with command `python ./manage.py runserver 0.0.0.0:22549 --noreload`
2012-08-01T18:41:46+00:00 app[web.1]: Validating models...
2012-08-01T18:41:46+00:00 app[web.1]:
2012-08-01T18:41:46+00:00 app[web.1]: Traceback (most recent call last):
2012-08-01T18:41:46+00:00 app[web.1]:   File "./manage.py", line 10, in <module>
2012-08-01T18:41:46+00:00 app[web.1]:     execute_from_command_line(sys.argv)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
2012-08-01T18:41:46+00:00 app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2012-08-01T18:41:46+00:00 app[web.1]:     utility.execute()
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
2012-08-01T18:41:46+00:00 app[web.1]:     self.execute(*args, **options.__dict__)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 80, in run
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 69, in handle
2012-08-01T18:41:46+00:00 app[web.1]:     output = self.handle(*args, **options)
2012-08-01T18:41:46+00:00 app[web.1]:     self.run(*args, **options)
2012-08-01T18:41:46+00:00 app[web.1]:     self.validate(display_num_errors=True)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
2012-08-01T18:41:46+00:00 app[web.1]:     self.inner_run(*args, **options)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
2012-08-01T18:41:46+00:00 app[web.1]:     num_errors = get_validation_errors(s, app)
2012-08-01T18:41:46+00:00 app[web.1]:     backend = load_backend(connection.settings_dict['ENGINE'])
2012-08-01T18:41:46+00:00 app[web.1]:     from django.db import models, connection
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
2012-08-01T18:41:46+00:00 app[web.1]:     return getattr(connections[DEFAULT_DB_ALIAS], item)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
2012-08-01T18:41:46+00:00 app[web.1]:     backend = load_backend(db['ENGINE'])
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 24, in load_backend
2012-08-01T18:41:46+00:00 app[web.1]:     return import_module('.base', backend_name)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 34, in import_module
2012-08-01T18:41:46+00:00 app[web.1]:     name = _resolve_name(name[level:], package, level)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 7, in _resolve_name
2012-08-01T18:41:46+00:00 app[web.1]:     raise ValueError("'package' not set to a string")
2012-08-01T18:41:46+00:00 app[web.1]: ValueError: 'package' not set to a string
2012-08-01T18:41:47+00:00 heroku[web.1]: Process exited with status 1
2012-08-01T18:41:47+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-01T18:46:00+00:00 heroku[slugc]: Slug compilation started
2012-08-01T18:48:55+00:00 heroku[api]: Release v5 created by [email protected]
2012-08-01T18:48:55+00:00 heroku[api]: Deploy f097e62 by [email protected]
2012-08-01T18:48:55+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-01T18:48:56+00:00 heroku[slugc]: Slug compilation finished
2012-08-01T18:48:58+00:00 heroku[web.1]: Starting process with command `python ./manage.py runserver 0.0.0.0:23141 --noreload`
2012-08-01T18:48:59+00:00 app[web.1]: Traceback (most recent call last):
2012-08-01T18:48:59+00:00 app[web.1]:   File "./manage.py", line 10, in <module>
2012-08-01T18:48:59+00:00 app[web.1]:     execute_from_command_line(sys.argv)
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
2012-08-01T18:48:59+00:00 app[web.1]:     utility.execute()
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 252, in fetch_command
2012-08-01T18:48:59+00:00 app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
2012-08-01T18:48:59+00:00 app[web.1]:     app_name = get_commands()[subcommand]
2012-08-01T18:48:59+00:00 app[web.1]:     apps = settings.INSTALLED_APPS
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
2012-08-01T18:48:59+00:00 app[web.1]:     mod = importlib.import_module(self.SETTINGS_MODULE)
2012-08-01T18:48:59+00:00 app[web.1]:     self._wrapped = Settings(settings_module)
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2012-08-01T18:48:59+00:00 app[web.1]:     self._setup()
2012-08-01T18:48:59+00:00 app[web.1]:     ^
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/myportfolio/settings.py", line 23
2012-08-01T18:48:59+00:00 app[web.1]: SyntaxError: invalid syntax
2012-08-01T18:48:59+00:00 app[web.1]:     __import__(name)
2012-08-01T18:48:59+00:00 app[web.1]:     }
2012-08-01T18:49:00+00:00 heroku[web.1]: Process exited with status 1
2012-08-01T18:49:00+00:00 heroku[web.1]: State changed from starting to crashed
(venv)Jonathans-MacBook-Air-2:myportfolio jonathanschen$ heroku ps
=== web: `python ./manage.py runserver 0.0.0.0:$PORT --noreload`
web.1: crashed for 1m

(venv)Jonathans-MacBook-Air-2:myportfolio jonathanschen$ heroku ps
=== web: `python ./manage.py runserver 0.0.0.0:$PORT --noreload`
web.1: crashed for 2m

(venv)Jonathans-MacBook-Air-2:myportfolio jonathanschen$ heroku logs
2012-08-01T18:29:55+00:00 app[web.1]: ValueError: 'package' not set to a string
2012-08-01T18:29:56+00:00 heroku[web.1]: Process exited with status 1
2012-08-01T18:29:56+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-01T18:41:41+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-01T18:41:45+00:00 heroku[web.1]: Starting process with command `python ./manage.py runserver 0.0.0.0:22549 --noreload`
2012-08-01T18:41:46+00:00 app[web.1]: Validating models...
2012-08-01T18:41:46+00:00 app[web.1]:
2012-08-01T18:41:46+00:00 app[web.1]: Traceback (most recent call last):
2012-08-01T18:41:46+00:00 app[web.1]:   File "./manage.py", line 10, in <module>
2012-08-01T18:41:46+00:00 app[web.1]:     execute_from_command_line(sys.argv)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
2012-08-01T18:41:46+00:00 app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2012-08-01T18:41:46+00:00 app[web.1]:     utility.execute()
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
2012-08-01T18:41:46+00:00 app[web.1]:     self.execute(*args, **options.__dict__)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 80, in run
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 69, in handle
2012-08-01T18:41:46+00:00 app[web.1]:     output = self.handle(*args, **options)
2012-08-01T18:41:46+00:00 app[web.1]:     self.run(*args, **options)
2012-08-01T18:41:46+00:00 app[web.1]:     self.validate(display_num_errors=True)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
2012-08-01T18:41:46+00:00 app[web.1]:     self.inner_run(*args, **options)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
2012-08-01T18:41:46+00:00 app[web.1]:     num_errors = get_validation_errors(s, app)
2012-08-01T18:41:46+00:00 app[web.1]:     backend = load_backend(connection.settings_dict['ENGINE'])
2012-08-01T18:41:46+00:00 app[web.1]:     from django.db import models, connection
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
2012-08-01T18:41:46+00:00 app[web.1]:     return getattr(connections[DEFAULT_DB_ALIAS], item)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
2012-08-01T18:41:46+00:00 app[web.1]:     backend = load_backend(db['ENGINE'])
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 24, in load_backend
2012-08-01T18:41:46+00:00 app[web.1]:     return import_module('.base', backend_name)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 34, in import_module
2012-08-01T18:41:46+00:00 app[web.1]:     name = _resolve_name(name[level:], package, level)
2012-08-01T18:41:46+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 7, in _resolve_name
2012-08-01T18:41:46+00:00 app[web.1]:     raise ValueError("'package' not set to a string")
2012-08-01T18:41:46+00:00 app[web.1]: ValueError: 'package' not set to a string
2012-08-01T18:41:47+00:00 heroku[web.1]: Process exited with status 1
2012-08-01T18:41:47+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-01T18:46:00+00:00 heroku[slugc]: Slug compilation started
2012-08-01T18:48:55+00:00 heroku[api]: Release v5 created by [email protected]
2012-08-01T18:48:55+00:00 heroku[api]: Deploy f097e62 by [email protected]
2012-08-01T18:48:55+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-01T18:48:56+00:00 heroku[slugc]: Slug compilation finished
2012-08-01T18:48:58+00:00 heroku[web.1]: Starting process with command `python ./manage.py runserver 0.0.0.0:23141 --noreload`
2012-08-01T18:48:59+00:00 app[web.1]: Traceback (most recent call last):
2012-08-01T18:48:59+00:00 app[web.1]:   File "./manage.py", line 10, in <module>
2012-08-01T18:48:59+00:00 app[web.1]:     execute_from_command_line(sys.argv)
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
2012-08-01T18:48:59+00:00 app[web.1]:     utility.execute()
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 252, in fetch_command
2012-08-01T18:48:59+00:00 app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
2012-08-01T18:48:59+00:00 app[web.1]:     app_name = get_commands()[subcommand]
2012-08-01T18:48:59+00:00 app[web.1]:     apps = settings.INSTALLED_APPS
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
2012-08-01T18:48:59+00:00 app[web.1]:     mod = importlib.import_module(self.SETTINGS_MODULE)
2012-08-01T18:48:59+00:00 app[web.1]:     self._wrapped = Settings(settings_module)
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2012-08-01T18:48:59+00:00 app[web.1]:     self._setup()
2012-08-01T18:48:59+00:00 app[web.1]:     ^
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
2012-08-01T18:48:59+00:00 app[web.1]:   File "/app/myportfolio/settings.py", line 23
2012-08-01T18:48:59+00:00 app[web.1]: SyntaxError: invalid syntax
2012-08-01T18:48:59+00:00 app[web.1]:     __import__(name)
2012-08-01T18:48:59+00:00 app[web.1]:     }
2012-08-01T18:49:00+00:00 heroku[web.1]: Process exited with status 1
2012-08-01T18:49:00+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-01T19:03:18+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-01T19:03:21+00:00 heroku[web.1]: Starting process with command `python ./manage.py runserver 0.0.0.0:20934 --noreload`
2012-08-01T19:03:22+00:00 app[web.1]: Traceback (most recent call last):
2012-08-01T19:03:22+00:00 app[web.1]:   File "./manage.py", line 10, in <module>
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
2012-08-01T19:03:22+00:00 app[web.1]:     execute_from_command_line(sys.argv)
2012-08-01T19:03:22+00:00 app[web.1]:     utility.execute()
2012-08-01T19:03:22+00:00 app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 252, in fetch_command
2012-08-01T19:03:22+00:00 app[web.1]:     app_name = get_commands()[subcommand]
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
2012-08-01T19:03:22+00:00 app[web.1]:     apps = settings.INSTALLED_APPS
2012-08-01T19:03:22+00:00 app[web.1]:     self._setup()
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
2012-08-01T19:03:22+00:00 app[web.1]:     self._wrapped = Settings(settings_module)
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
2012-08-01T19:03:22+00:00 app[web.1]:     mod = importlib.import_module(self.SETTINGS_MODULE)
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2012-08-01T19:03:22+00:00 app[web.1]:   File "/app/myportfolio/settings.py", line 23
2012-08-01T19:03:22+00:00 app[web.1]:     ^
2012-08-01T19:03:22+00:00 app[web.1]: SyntaxError: invalid syntax
2012-08-01T19:03:22+00:00 app[web.1]:     __import__(name)
2012-08-01T19:03:22+00:00 app[web.1]:     }
2012-08-01T19:03:23+00:00 heroku[web.1]: Process exited with status 1
2012-08-01T19:03:24+00:00 heroku[web.1]: State changed from starting to crashed


推荐答案

有同样的问题当查看日志(英雄日志)时,原来找不到模块psycopg2。

Had the same issue and when looking at the logs (heroku logs) it turned out that it couldn't find the module psycopg2.

将psycopg2 == 2.4.5添加到requires.txt中文件解决了它

Adding psycopg2==2.4.5 to the requirements.txt file solved it

这篇关于Django应用程序在Heroku中崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 14:18