From ea65715ef8f76d5adcb4d459e8f9f42e7d45f16d Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 2 Oct 2015 12:06:12 -0700 Subject: [PATCH] manage.py: Give a nice error message if run as root on posix systems. If the os is posix, this will check to see if the user is root and alert them to run as zulip user if so. Fixes #114. --- manage.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manage.py b/manage.py index afb02d13a7..a81674a0e1 100755 --- a/manage.py +++ b/manage.py @@ -5,6 +5,9 @@ import logging import subprocess if __name__ == "__main__": + if 'posix' in os.name and os.geteuid() == 0: + from django.core.management.base import CommandError + raise CommandError("manage.py should not be run as root.") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings") from django.conf import settings