Creating a Django Project
1
| django-admin startproject your_project_name
|
Creating an App
1
2
3
| django-admin.py startapp your_app_name
# 或者
python manage.py startapp your_app_name
|
python manage.py and django-admin do essentially the same thing. The difference is that python manage.py also sets the DJANGO_SETTINGS_MODULE environment variable and adds the project’s path to sys.path. The recommendation is to use django-admin only when creating a project, and python manage.py in all other cases.
Initializing Data
1
| python manage.py migrate
|
Creating the Cache Table
1
2
| python manage.py createcachetable [cache_table_name]
# 默认表名 django_cache
|
Clearing All Data
1
| python manage.py flush --noinput
|
Starting the Service on a Specified Port
1
| python manage.py runserver 0.0.0.0:8000
|
Starting Celery Background Tasks
1
| python manage.py celery worker --settings=settings -l info -c 4 --autoreload
|
Starting Celery Periodic Tasks
1
| python manage.py celery beat
|
Installing the Project’s Dependencies
1
| pip install -r requirements.txt
|
Killing All Python Processes
1
2
| taskkill -f -im python
taskkill -f -im python.exe
|
Killing All uwsgi Processes
1
| ps aux|grep uwsgi|awk '{print $2}'|xargs kill -9
|
Starting Django with uwsgi