2013-08-04 11 views
11

私は試しにsatchmoを取得しますが、最初は試してみると大きな問題があり、何が間違っているのか分かりません。 私は明確なDjangoのプロジェクトに$ python clonesatchmo.pyを作り、それがエラーtrows:Satchmo clonesatchmo.py ImportError:名前をインポートできませんexecute_manager

$ python clonesatchmo.py 
Creating the Satchmo Application 
Customizing the files 
Performing initial data synching 
Traceback (most recent call last): 
    File "manage.py", line 18, in <module> 
    from django.core.management import execute_manager 
ImportError: cannot import name execute_manager 
Traceback (most recent call last): 
File "manage.py", line 18, in <module> 
    from django.core.management import execute_manager 
ImportError: cannot import name execute_manager 
Error: Can not copy the static files. 
Error: Can not syncdb. 

を、店舗のフォルダを作成します。このような しようとしてなめらかに!!取り組んでいる:

$ python manage.py shell 
>>> import os, sys 
>>> print sys.executable 
/some/path/to/python 
>>> os.system('bash') 
$ /some/path/to/python manage.py validate 
# this is NOT fail on "from django.core.management import execute_manager" 

私はジャンゴ1.6とサッチモ0.9.3、Pythonのを持っている2.7.5

+0

「私はvirtualenvを使用していません」orly? '/ some/path/to/python'は確実に1のように見えます。 – AdamKG

+0

@AdamKGしかし、それは標準的なパスです...このアクションを行うためにGoogleグループでアドバイスされています.. "/ some/path/to/python"は:/Library/Frameworks/Python.framework/Versions/2.7/です。 Resources/Python.app/Contents/MacOS/Python' – Pruntoff

答えて

11

execute_managerは非推奨のパスに置かれた(私はvirtualenvのを使用していません) Django 1.4 https://docs.djangoproject.com/en/1.4/releases/1.4/#django-core-management-execute-managerのプロジェクトレイアウトリファクタの一環として使用します。非推奨ポリシーによれば、execute_managerのコードは1.6で完全に削除されています。このインポートエラーが表示された場合、使用しているSatchmoのバージョンはDjango 1.6と互換性があるように更新されていません。

+1

ありがとうございました!しかし、私はどのようにそれを置き換える場所を見つけることができますか?私は 'manage.pyのすべてのインポートを置き換えますが、それは私が間違っているようだ... – Pruntoff

+0

このインポートを修正しても、私はあなたがこの作業を得ることができるとは思わない。 Satchmoは、現在ベータ版になっているDjango 1.5よりもはるかに少ない1.6をサポートすると主張していません。 –

65

manage.pyの内容を次のものに置き換えてください(新しいdjango 1.6プロジェクトのもの)。

#!/usr/bin/env python 
import os 
import sys 

if __name__ == "__main__": 
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<app>.settings") 

    from django.core.management import execute_from_command_line 

    execute_from_command_line(sys.argv) 
+7

今、これは受け入れられた回答でなければなりません。 – swdev

+0

それも私のために働いた! –

+1

これはdjangoからapiを使用するためのGoogleの例をどのように使用するかを理解するのに役立ちましたhttp://code.google.com/p/google-api-python-client/source/browse/#hg%2Fsamples%2Fdjango_sample – Michael