Home > Enterprise >  Django & Migrate Error: I can't migrate my project
Django & Migrate Error: I can't migrate my project

Time:07-22

I was trying to run a Django project which I got from someone else. But I can't do the migration. I came from a mobile app development background. So I'm quite new to this backend thing including Django.

Please have a look and help with this issue. Thank you

Traceback (most recent call last):
      File "/Users/punreachrany/Desktop/MyProject/manage.py", line 22, in <module>
        main()
      File "/Users/punreachrany/Desktop/MyProject/manage.py", line 18, in main
        execute_from_command_line(sys.argv)
      File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
        utility.execute()
      File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/core/management/__init__.py", line 420, in execute
        django.setup()
      File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
        apps.populate(settings.INSTALLED_APPS)
      File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
        app_config = AppConfig.create(entry)
      File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/apps/config.py", line 228, in create
        import_module(entry)
      File "/Users/punreachrany/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'bootstrap4'

CodePudding user response:

Bootstrap is a dependency you need to add. You can install it by running the below command before migrating.(This is a one time setup)

python -m pip install bootstrap4

Since you mentioned you got the project from someone else.In that case check if there is a file called requirements.txt.

If it exists, run the below command from that directory to install all the required dependencies.

Python -m pip install -r requirements.txt
  • Related