簡體   English   中英

我該如何解決 AttributeError 'NoneType' object has no attribute 'write'

[英]how can i solve AttributeError 'NoneType' object has no attribute 'write'

python manage.py 遷移

  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\commands\migrate.py", line 162, in handle
    self.stdout.write(self.style.MIGRATE_HEADING("Operations to perform:"))
  File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 145, in write
    self._out.write(style_func(msg))
AttributeError: 'NoneType' object has no attribute 'write'

請任何人都可以幫助解決此錯誤。 它在我嘗試使用 manage.py 時彈出。 請任何人

您可以 go 到Migrations文件夾並刪除除init .py 之外的所有文件

然后運行

python manage.py makemigrations

python manage.py migrate 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM