heroku deploy:ImportError:没有名为' django.contrib.staticfiles'

时间:2015-07-03 03:17:45

标签: django heroku

我正在将我的应用部署到heroku。我坚持这个代码:

$ heroku run python mysite/manage.py migrate

输出为:

Running `python mysite/manage.py migrate` attached to terminal... up, run.8367
Traceback (most recent call last):
  File "/app/mysite/django/apps/config.py", line 118, in create
    cls = getattr(mod, cls_name)
AttributeError: 'module' object has no attribute 'staticfiles'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mysite/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/mysite/django/core/management/__init__.py", line 385, in execute_fr
om_command_line
    utility.execute()
  File "/app/mysite/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/app/mysite/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/app/mysite/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/app/mysite/django/apps/config.py", line 123, in create
    import_module(entry)
  File "/app/.heroku/python/lib/python3.3/importlib/__init__.py", line 90, in im
port_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1529, in _find_and_load_unlocked
ImportError: No module named 'django.contrib.staticfiles'

有人可以帮助我吗?我在静态文件上搜索了很多,但它不起作用......

1 个答案:

答案 0 :(得分:0)

仔细检查您的staticfiles contrib是否已通过以下方式安装:

pip install django-staticfiles

注意:如果pip指向您的Python 2实例,请改用pip3

然后验证您的PYTHONPATH是否有正确的路径。