这是一个创建于 4408 天前的主题,其中的信息可能已经有所发展或是发生改变。
I generate a django project and its directory structure is like the following:
-myproject
--__init__.py
--settings.py
--rooturls.py
--dbUtils.py
--app1
---__init__.py
---views.py
---urls.py
--app2
---__init__.py
---views.py
---urls.py
I want to import dbUtils in my apps , so I configure in my settings.py:
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.insert(0, PROJECT_ROOT)
However, the program still can't find the moudle.
2 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
bigeagle 2012-09-11 13:08:31 +08:00
PROJECT_ROOT = os.path.dirname( os.path.abspath(__file__) )
|
|
|
2
ccp0101 2012-09-12 15:25:09 +08:00
我的Django项目写的是
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
|