Beispiel #1
0
 def test_bool(self, env: yaenv.Env):
     """it can cast to bool"""
     _val = env.bool('BOOL_VAR')
     assert not _val and type(_val) == bool
     _val = env.bool('INT_VAR')
     assert _val and type(_val) == bool
     _val = env.bool('MISSING', True)
     assert _val and type(_val) == bool
     with pytest.raises(yaenv.EnvError) as err:
         _ = env.bool('FLOAT_VAR')
     assert 'Invalid boolean' in str(err.value)
     assert env.bool('MISSING') is None
Beispiel #2
0
###############
#    Basic    #
###############

#: A list of host/domain names that this site can serve.
#: See :setting:`ALLOWED_HOSTS`.
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', [
    '127.0.0.1', '0.0.0.0', 'localhost', '[::1]',
    # From https://stackoverflow.com/questions/9626535/#36609868
    env['DOMAIN'].split('//')[-1].split('/')[0].split('?')[0]
])

#: | A boolean that turns debug mode on/off. See :setting:`DEBUG`.
#: | **SECURITY WARNING: never turn this on in production!**
DEBUG = env.bool('MANGADV_DEBUG', False)

#: | A secret key used to provide cryptographic signing.
#:   See :setting:`SECRET_KEY`.
#: | **SECURITY WARNING: this must be kept secret!**
SECRET_KEY = env.secret('SECRET_KEY')

#: The ID of the current site. See :setting:`SITE_ID`.
SITE_ID = 1

#####################
#    Application    #
#####################

#: A list of strings designating all applications
#: that are enabled in this Django installation.
Beispiel #3
0
###############
#    Basic    #
###############

#: A list of host/domain names that this site can serve.
#: See :setting:`ALLOWED_HOSTS`.
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', [
    '127.0.0.1', '0.0.0.0', 'localhost', '[::1]',
    # From https://stackoverflow.com/questions/9626535/#36609868
    env['DOMAIN'].split('//')[-1].split('/')[0].split('?')[0]
])

#: | A boolean that turns debug mode on/off. See :setting:`DEBUG`.
#: | **SECURITY WARNING: never turn this on in production!**
DEBUG = env.bool('MANGADV_DEBUG', False)

#: | A secret key used to provide cryptographic signing.
#:   See :setting:`SECRET_KEY`.
#: | **SECURITY WARNING: this must be kept secret!**
SECRET_KEY = env.secret('SECRET_KEY')

#: The ID of the current site. See :setting:`SITE_ID`.
SITE_ID = 1

#####################
#    Application    #
#####################

#: A list of strings designating all applications
#: that are enabled in this Django installation.