There was a great solution to this posted just yesterday ...
import sys if 'runserver' in sys.argv: DEBUG = True else: DEBUG = False ... which suggests if 'test' in sys.argv: do this On 24/11/2011 9:53am, Gelonida N wrote:
Hi, I just started reading about django testing. Now I have a small question. Whe running tests I would like to change a few variables in settings.py, but keep all the rest identical. Example: - I might like ot change the media directory - I might like to use another db engine How can I achieve this best. The idea, that I have, but that feels a little clumsy is: create a test_settings.py file. test_settings.py will just impoert everything from settings.py and then override the values it wants to. Somehow I would prefer if settings.py could contain a few if statements of the kind. if testing: dothis else: dothat and if I could just type ./manage.py test Is this possible? How do you handle such setups?
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.