0

我试图将我的新代码推送到 Heroku,但我遇到了一个ImportError说:

Starting process with command `python manage.py runserver --insecure 0.0.0.0:13192 --noreload`
Traceback (most recent call last):
    execute_from_command_line(sys.argv
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
File "manage.py", line 10, in <module>
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
  File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
    from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException, \
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
File "/app/.heroku/python/lib/python2.7/site-packages/devserver/management/commands/runserver.py", line 3, in <module>
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class
  utility.execute()
ImportError: cannot import name AdminMediaHandler

我在文档中发现django.core.servers.basehttp.AdminMediaHandler从 1.4 开始将被替换为django.contrib.staticfiles.handlers.StaticFilesHandler. 我的问题是我在哪里StaticFilesHandler放置AdminMediaHandler

更新:我现在尝试通过提出git+git://github.com/dcramer/django-devserver#egg=django-devserver我的要求将两个补丁合并在一起。但是我在尝试部署时仍然收到同样的错误

4

1 回答 1

0

无需尝试将 django-devserver 的补丁合并在一起。Django-devserver 0.5.0 与 Django 1.5 兼容,一旦我将“django-devserver 0.5.0”放在我的 requirements.txt 中,我的应用程序就可以部署而不会崩溃。

于 2013-03-27T16:39:16.867 回答