sudo vim /etc/rc.local
里面的代码写成这样的
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
就是下面这句 最后这个&字符表示后台启动
/usr/bin/python /home/yanzefeng/webroot/nxserver/manage.py runserver 0.0.0.0:8000 &
exit 0