1.创建项目 luffy
django-admin.py startproject luffy
2, 创建app web, 并在settings.py 文件中添加该app
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # Api 'web', ]
3.在web下建management.commands模块
4.在commands下建eventcheck.py文件
5.编写eventcheck.py
6.执行python manage.py 检查下是否有这个命令
[auth]
changepassword
createsuperuser
[contenttypes]
remove_stale_contenttypes
[django]
check
...
makemessages
makemigrations
migrate
sendtestemail
shell
...
startapp
startproject
[web]
eventcheck
7.执行python manage.py eventcheck
就会执行 eventcheck.py下的内容了