开发者

Can you pass multiple paths to the Django runserver --pythonpath directive?

For each of my projects I create an apps directory that holds all the apps I need. Satchmo also has an apps directory. Can I do something like python manage.py runserver --pythonpath=/path/to/my/apps /path开发者_如何学Go/to/satchmo/apps? Is there some separator that it can take?


There's no --pythonpath option to runserver. You either want to add it to your .bashrc file or in your settings.py file add something like the following at the top:

import os,sys
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
sys.path.append(PROJECT_ROOT, 'to', 'my', 'apps')
sys.path.append(os.path.join('path', 'to', 'satchmo', 'apps'))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜