Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change environment variable before django settings will be initialized? #1136

Open
mihalt opened this issue Aug 30, 2024 · 0 comments

Comments

@mihalt
Copy link

mihalt commented Aug 30, 2024

I try to use this, but in fact settings var that was initialized in docker container doesn't change.

conftest.py

@pytest.hookimpl(tryfirst=True)
def pytest_load_initial_conftests(early_config, parser, args):
    os.environ["CH_BASE_OF_URL"] = 'https://api.cowho.com'

settings.py

CH_BASE_URL = os.environ.get('CH_BASE_OF_URL')

I tried to use pytest_configure. It doesn't work too. Just passing of settings fixture to the test doesn't work for me, because initialization of data appears after django_db_blocker.unblock() by signal and depends from settings variable too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant