python manage.py makemigrations projectmanage Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "D:Program FilesPython3.6libsite-packagesdjangocoremanagement\__init__.py", line 401, in execute_from_command_line utility.execute() File "D:Program FilesPython3.6libsite-packagesdjangocoremanagement\__init__.py", line 377, in execute django.setup() File "D:Program FilesPython3.6libsite-packagesdjango\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "D:Program FilesPython3.6libsite-packagesdjangoapps egistry.py", line 114, in populate app_config.import_models() File "D:Program FilesPython3.6libsite-packagesdjangoappsconfig.py", line 211, in import_models self.models_module = import_module(models_module_name) File "D:Program FilesPython3.6libimportlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "E:WF_WorkHappyAutoTestprojectmanagemodels.py", line 10, in <module> from rest_framework.authtoken.models import Token File "D:Program FilesPython3.6libsite-packages est_frameworkauthtokenmodels.py", line 6, in <module> from django.utils.encoding import python_2_unicode_compatible ImportError: cannot import name 'python_2_unicode_compatible'
解决方案:
#请使用
from six import python_2_unicode_compatible
#替代
from django.utils.encoding import python_2_unicode_compatible
再次执行不报错
python manage.py makemigrations projectmanage System check identified some issues: Migrations for 'projectmanage': projectmanagemigrations 001_initial.py - Create model Project