2017-06-17 112 views
0

由於需要輸入的任何python manage.py命令(在不提供默認值的情況下移除null = True,重新收集靜態文件...)不接受所述輸入。當我按下回車鍵時,只需在控制檯中顯示回車字符「」。我不知道如何調試這一點,因爲ctrl+ c只是給回溯這樣的:需要輸入的Django manage.py命令被卡住

./manage.py makemigrations 
You are trying to change the nullable field 'package' on company to non-nullable without a default; we cannot do that (the database needs something to populate existing rows). 
Please select a fix: 
1) Provide a one-off default now (will be set on all existing rows with a null value for this column) 
2) Ignore for now, and let me handle existing rows with NULL myself (e.g. because you added a RunPython or RunSQL operation to handle NULL values in a previous data migration) 
3) Quit, and let me add a default in models.py 
Select an option: 1^M^M^M^C^CKeyboardInterrupt 

The above exception was the direct cause of the following exception: 

Traceback (most recent call last): 
    File "./manage.py", line 22, in <module> 
    execute_from_command_line(sys.argv) 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line 
    utility.execute() 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute 
    output = self.handle(*args, **options) 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 177, in handle 
    migration_name=self.migration_name, 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/db/migrations/autodetector.py", line 47, in changes 
    changes = self._detect_changes(convert_apps, graph) 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/db/migrations/autodetector.py", line 189, in _detect_changes 
    self.generate_altered_fields() 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/db/migrations/autodetector.py", line 920, in generate_altered_fields 
    new_default = self.questioner.ask_not_null_alteration(field_name, model_name) 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/db/migrations/questioner.py", line 182, in ask_not_null_alteration 
    "Quit, and let me add a default in models.py", 
    File "/Users/mac/.virtualenvs/mindance/lib/python3.6/site-packages/django/db/migrations/questioner.py", line 99, in _choice_input 
    result = input("Select an option: ") 
SystemError: <built-in function input> returned a result with an error set 

對如何處理這個問題的任何提示?我重新安裝了我的virtualenv。也許我應該重新安裝python?

版本: 的Python 3.6.1 Django的== 1.11.2

回答

2

運行此命令stty sane在Ubuntu的終端,然後再嘗試使用python manage.py migrate

+0

運行遷移我重新安裝了蟒蛇已經和固定問題。任何想法可能會造成這種情況? –