1👍
✅
You could run the tests with a special settings.py, by setting the DJANGO_SETTINGS_MODULE environment variable. This special “testsettings.py” can import * from the normal settings.py, and then add the necessary extra apps to INSTALLED_APPS.
Remember that settings.py files are just ordinary Python modules, so you can add any logic you want to get the list of extra apps from somewhere.
0👍
Django provides the modify_settings()
context manager for easier settings changes:
class TestSomeApp(TestCase):
def test_some_app(self):
with self.modify_settings(
INSTALLED_APPS={"prepend": "some_app"}
):
# ...
- [Answer]-Django CMS + uWSGI + virtualenv + socket causing PendingDeprecationWarning error in uWSGI logs
- [Answer]-Django admin form – ManyToMany behavior with ForeignKey
- [Answer]-Dynamically Create Table With Javascript and Jquery for each entry in a list
Source:stackexchange.com