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.
This commit is contained in:
Raphael 2015-10-02 12:06:12 -07:00 committed by Tim Abbott
parent e4cea98ccd
commit ea65715ef8
1 changed files with 3 additions and 0 deletions

View File

@ -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