我正在尝试对包含近百个类的大型models.py
文件进行makemigration。命令manage.py makemigrations <app_name>
给了我MemoryError
。我认为这与大型models.py
文件有关。
File "/home/venv_two/local/lib/python2.7/site-
packages/django/core/management/commands/makemigrations.py", line 231,
in write_migration_files migration_string = writer.as_string()
File "/home/venv_two/local/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 166, in as_string
items["operations"] = "\n".join(operations) + "\n" if operations else ""
MemoryError