Khi thay đổi tên app, ngoài việc replace các references, imports,… cần lưu ý đến việc update migrations.

Nguyên nhân: Hệ thống đã migrate các migrations, sinh ra các tables. Khi đổi tên app, chạy lệnh python manage.py migrate thì Django sẽ coi các file migrations với app tên mới là các migrations mới, có thể dẫn đến lỗi table already exists

Ví dụ old_name là tên cũ của app, new_name là tên mới của app, thì cần chạy các lệnh:

update django_content_type set app_label='new_name' where app_label='old_name';
update django_migrations set app='new_name' where app='old_name';

Câu lệnh SQL này sẽ cập nhật lịch sử migration.