2015-07-03 60 views
0

我正在將我的應用程序部署到heroku。我被困在此代碼:heroku部署:ImportError:沒有名爲'django.contrib.staticfiles'的模塊

$ 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' 

任何人都可以幫助我嗎?我搜索了staticfiles很多,但它不工作...

+2

需要一些更多的信息,比如Django的哪個版本,對於初學者 – TheGeorgeous

+0

>>> django.VERSION (1,7,8,'final,0') – Joanna

+0

你能顯示你的設置文件嗎? INSTALLED_APPS部分 –

回答

0

仔細檢查你的staticfiles的contrib通過安裝:

pip install django-staticfiles 

注:如果pip點到你的Python 2實例,那麼改爲使用pip3

然後驗證您的PYTHONPATH是否具有正確的路徑。

相關問題