Re: media directory for testing
Another solution is to use environment variables for the settings that are different. You can then use the same settings file for all different environments. All you have to do is to read the environment variables in the settings file, something like: DATABASE_NAME = os.environ["DATABASE_NAME"] Cheers, Amit ביום ראשון 11 נובמבר 2007, 02:43, נכתב על ידי Malcolm Tredinnick: > > On Sat, 2007-11-10 at 16:52 -0500, Faheem Mitha wrote: > > > > Hi. > > > > I'm having the following problem while testing. I'm writing a unit test > > for a file upload (using newforms). This works. However, the file gets > > written to the same media directory as is used in normal work. I'd prefer > > this happened somewhere where it would have no impact on normal > > functioning, possibly /tmp. Does anyone have suggestions on what to do? > > One workaround would be to redefine the media directory in the tests > > themselves, if I can figure out how to do that... > > The "normal" would be to have a settings file that is used specifically > for testing. You can put "from normal_settings import *" at the top and > then just override the settings you need to. > > It's not always going to be the case that you development, production > and testing settings are identical. So take advantage of the fact you > can have multiple settings files. > > Regards, > Malcolm > > -- > For every action there is an equal and opposite criticism. > http://www.pointy-stick.com/blog/ > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: media directory for testing
On Sat, 2007-11-10 at 16:52 -0500, Faheem Mitha wrote: > > Hi. > > I'm having the following problem while testing. I'm writing a unit test > for a file upload (using newforms). This works. However, the file gets > written to the same media directory as is used in normal work. I'd prefer > this happened somewhere where it would have no impact on normal > functioning, possibly /tmp. Does anyone have suggestions on what to do? > One workaround would be to redefine the media directory in the tests > themselves, if I can figure out how to do that... The "normal" would be to have a settings file that is used specifically for testing. You can put "from normal_settings import *" at the top and then just override the settings you need to. It's not always going to be the case that you development, production and testing settings are identical. So take advantage of the fact you can have multiple settings files. Regards, Malcolm -- For every action there is an equal and opposite criticism. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
media directory for testing
Hi. I'm having the following problem while testing. I'm writing a unit test for a file upload (using newforms). This works. However, the file gets written to the same media directory as is used in normal work. I'd prefer this happened somewhere where it would have no impact on normal functioning, possibly /tmp. Does anyone have suggestions on what to do? One workaround would be to redefine the media directory in the tests themselves, if I can figure out how to do that... Faheem. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---