django中创建一个project之后,就会创建一个以项目名称命名的文件中,文件夹中包含了一个同名文件夹和一个manage.py文件。比如:
之后如果要启动服务、同步数据库等操作,都是用python manage.py 开头的,因此manage.py程序显然是服务器操作的入口。
其详细用法可参考官方文档
https://docs.djangoproject.com/en/2.2/ref/django-admin/
其中,开头提到一句话:
In addition, manage.py is automatically created in each Django project. It does the same thing as django-admin but also sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project’s settings.py file.
意思是manage.py和django-admin的作用一样。
来看一下manage.py文件,包含注释才20行代码
逐行看下去
这