Django web specifies the Chinese character set
When creating a simplecmdb project with django under linux, if you use Chinese encoding, you need to use the uft8 character set when creating a mysql database.
CREATE Datase`cmdb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
Avoid unnecessary trouble.
If you specify a mysql database, modify the database under settings.py. The default is SQLite database.
ENGINE is the database used, name is the database, and user is the user Password is the password DATABASES = {'default': {' ENGINE': 'django.db.backends.mysql',' NAME': 'cmdb',' USER': 'root',' PASSWORD':', 'HOST':' 127.0.0.1, 'PORT':' 3306,}} LANGUAGE_CODE = 'zh-cn' / / changed to Chinese
[root@web simplecmdb] # yum install-y MySQL-python.i686 / / install mysql module if it is 64-bit, please install 64-bit.
[root@web simplecmdb] # python manage.py syncdb / / django automatically creates data synchronization data
Refer to the official document https://docs.djangoproject.com/en/1.10/topics/install/#database-installation