Wiadomość napisana w dniu 2009-08-20, o godz. 13:15, przez ringemup: > Oh, I wasn't asking about what physical server or what host the site > is running on. I was hoping someone could tell me a way to determine > at runtime whether it's running off the Django development server > (manage.py runserver) as opposed to Apache et al. > > > On Aug 20, 4:25 am, Andreas Madsack <andr...@madflex.de> wrote: >> Hi, >> >> why not get the hostname of the system? >> >> import socket >> hostname = socket.gethostname() >> if hostname == 'srv01.example.com': >> SERVER='production' >> else: >> SERVER='testing' >> >> Kind regards, >> >> Andreas. >> >> On Wed, Aug 19, 2009 at 4:52 PM, Thomas Guettler<h...@tbz-pariv.de> >> wrote: >> >>> Hi, >> >>> AFAIK there is no such variable in settings.py. It would be nice >>> to have it. >>> In your company we use the variable STAGE. >> >>> ringemup schrieb: >>>> Is there any way to check at runtime whether Django is running on >>>> the >>>> development server? >> >>>> Thanks!
Long ago I tried to check the value of os.environ['SERVER_SOFTWARE'], but I cann't recall if this was succesful. -- Artificial intelligence stands no chance against natural stupidity Jarek Zgoda, R&D, Redefine jarek.zg...@redefine.pl --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---