2011-03-02 30 views

回答

0

您是否在設置> Python解釋器中爲您的項目選擇了正確的Python安裝?

+0

是的。我使用2.7。 – 2011-03-02 20:57:46

1

這可能不是理想的解決方案,但它的工作原理和來自我老闆的禮貌。

修改pycharm的django_manage.py,在所有現有代碼之前在頂部插入以下代碼。可以在[PyCharm安裝目錄] /helpers/pycharm/django_manage.py中找到django_manage.py。

import site 
import sys 

# Add the locations missing from PYTHONPATH when running a manage.py task here. 
ALLDIRS = [ 
    r'C:\git_repos\src\dev\common\py', 
    r'C:\git_repos\src\dev\main_website', 
] 

# Remember original sys.path. 

prev_sys_path = list(sys.path) 

# Add each new site-packages directory. 

for directory in ALLDIRS: 
    site.addsitedir(directory) 

# Reorder sys.path so new directories at the front. 

new_sys_path = [] 
for item in list(sys.path): 
    if item not in prev_sys_path: 
     new_sys_path.append(item) 
     sys.path.remove(item) 
sys.path[:0] = new_sys_path 
+0

謝謝Wogan!好多了。 – 2011-03-03 19:24:46

相關問題