我有以下方法来创建项目,如下所示。
import os
project_directory = "/Users/home/project_directory/"
def create_function(project_name):
os.system("django-admin.py startproject {0} {1}".format(
project_name,
project_directory
)
)
当我使用全局python shell时这很好用但是当我使用python manage.py shell尝试相同的命令时遇到以下错误。我以为我在搞乱python路径,请帮帮我
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named mysite.settings