Error with makemigrations and migrate

I edited the mode.py file for a custom registration form. After running

make update-db

I get

Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

as an error message. So following this I try running

python manage.py makemigrations

and get this as an error

Traceback (most recent call last): File "./manage.py", line 20, in <module> from safe_lxml import defuse_xml_libs ImportError: No module named safe_lxml

Tried looking on web no luck so far. Please Help.

Version: Ironwood(Docker)
OS: Linux

1 Like

hi,
me too
try to run this command

/edx/bin/edxapp-migrate-lms
1 Like

@Hrithik_Raj is it work with you?

nope. After running the suggested command the update happens but the expected change is not seen.
Thanks for replying tho.

finally, I found the solution:
try to run these commands:

cd /edx/app/edxapp/edx-platform
./manage.py lms makemigrations reg_extension_form
./manage.py lms migrate reg_extension_form
sudo /edx/bin/supervisorctl restart lms

note: replace reg_extension_form with your folder name that have customization

References :

@Hrithik_Raj, have you tried installing safe_lxml manually on your devstack? You can do it like this:

make lms-shell
pip install -e /edx/app/edxapp/edx-platform/common/lib/safe_lxml/

Then you can run the makemigrations again.

1 Like