Where and how do I set an environmental variable u

2019-09-05 15:36发布

I'm trying to use this env variable to specify the path for my templates and it will probably be easier to do this using git or svn.

2条回答
欢心
2楼-- · 2019-09-05 16:00

The reference material is here. But the operative line for your project path (in case that's what you mean) is:

sys.path.append('/path/to/project')

However, your template path is set within your settings.py file:

TEMPLATE_DIRS = ( '/path/to/templatedir1', '/path/to/templatedir2' )
查看更多
手持菜刀,她持情操
3楼-- · 2019-09-05 16:12

In you app.wsgi file do:

import os
os.environ['MY_ENV_VARIABLE'] = 'value'
# e.g. os.environ['MPLCONFIGDIR'] = '/path/to/config/dir'
查看更多
登录 后发表回答