コード例 #1
0
    def test_inbuild_in_deploy_phase_is_false(self):

        config = Config(self.mockEnvironmentDeploy)
        self.assertFalse(config.in_build())
コード例 #2
0
    def test_on_platform_returns_correctly_in_build(self):

        config = Config(self.mockEnvironmentBuild)
        self.assertTrue(config.in_build())
コード例 #3
0
    def test_inbuild_in_build_phase_is_true(self):

        config = Config(self.mockEnvironmentBuild)
        self.assertTrue(config.in_build())
コード例 #4
0
ファイル: settings.py プロジェクト: ludoge/template-builder
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = '/static/'
# Default STATIC_ROOT, i.e. for local testing.
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

# Import some Platform.sh settings from the environment.
config = Config()
if config.is_valid_platform():

    if config.appDir:
        STATIC_ROOT = os.path.join(config.appDir, 'static')
    if config.projectEntropy:
        SECRET_KEY = config.projectEntropy

    if not config.in_build():
        db_settings = config.credentials('database')
        DATABASES = {
            'default': {
                'ENGINE': 'django.db.backends.postgresql',
                'NAME': db_settings['path'],
                'USER': db_settings['username'],
                'PASSWORD': db_settings['password'],
                'HOST': db_settings['host'],
                'PORT': db_settings['port'],
            },
            'sqlite': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
            }
        }