"""Manipulate a daemon via a pidfile, or become one ourselves.

Note that on principle we don't remove bad pidfiles, because they indicate a
bug, and are potentially useful for debugging.

If the command is 'start' or 'runserver' we proceed with the program. Stop,
restart, and status will raise SystemExit.

"""
import os

import charles
from charles.ipc.pidfile import PIDFile


# PIDFile
# =======
# This only gets written in CHILD of a daemon.

pidpath = os.path.abspath('django.pid')
pidfile = PIDFile(pidpath)
pidfile = pidfile


# Daemon
# ======

if not charles.WINDOWS:
    from charles.ipc.daemon import Daemon
    root = os.getcwd()
    daemon = Daemon(pidfile, root)


7148d143498390369921ba12ca159aeabe0ec811
<mask token>

<mask token>
if not charles.WINDOWS:
    from charles.ipc.daemon import Daemon
    root = os.getcwd()
    daemon = Daemon(pidfile, root)

<mask token>
pidpath = os.path.abspath('django.pid')
pidfile = PIDFile(pidpath)
pidfile = pidfile
if not charles.WINDOWS:
    from charles.ipc.daemon import Daemon
    root = os.getcwd()
    daemon = Daemon(pidfile, root)

<mask token>
import os
import charles
from charles.ipc.pidfile import PIDFile
pidpath = os.path.abspath('django.pid')
pidfile = PIDFile(pidpath)
pidfile = pidfile
if not charles.WINDOWS:
    from charles.ipc.daemon import Daemon
    root = os.getcwd()
    daemon = Daemon(pidfile, root)

"""Manipulate a daemon via a pidfile, or become one ourselves.

Note that on principle we don't remove bad pidfiles, because they indicate a
bug, and are potentially useful for debugging.

If the command is 'start' or 'runserver' we proceed with the program. Stop,
restart, and status will raise SystemExit.

"""
import os

import charles
from charles.ipc.pidfile import PIDFile


# PIDFile
# =======
# This only gets written in CHILD of a daemon.

pidpath = os.path.abspath('django.pid')
pidfile = PIDFile(pidpath)
pidfile = pidfile


# Daemon
# ======

if not charles.WINDOWS:
    from charles.ipc.daemon import Daemon
    root = os.getcwd()
    daemon = Daemon(pidfile, root)

