如果DEBUG = True,则排除包

时间:2018-03-01 11:08:16

标签: python django

如果storages,我想要排除包if DEBUG: storages = '' INSTALLED_APPS = [ ... 'app', storages, ... ] 。我该怎么做?

我的settings.py:

    $returndata = 'photo <img src="data:image/jpeg;base64,' . base64_encode($res1['@odata.context']) . '"/>';

2 个答案:

答案 0 :(得分:1)

你可以试试这个

INSTALLED_APPS = [
    .
    'app',

if not DEBUG:
    # Add the package into installed app only if debug is false otherwise use installed apps without package `storages`.
    INSTALLED_APPS += ('storages', )

答案 1 :(得分:0)

只需在settings.py

中添加此行代码即可
if not DEBUG:
    INSTALLED_APPS += ['storages']
相关问题