django命令合集

创建新应用:python manage.py startapp app

初使化数据库:python manage.py syncdb

更新脚本:python manage.py makemigrations

执行脚本:python manage.py migrate

执行测试:python ./manage.py test app/

创建超级用户:python manage.py createsuperuser

数据库创建与权限:

CREATE DATABASE IF NOT EXISTS crawlerpro DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'dbname';
GRANT ALL PRIVILEGES ON dbname.* TO 'user'@'localhost';
FLUSH   PRIVILEGES;
mysqladmin -u root password "newpass"