0

I created 2 model for one to one in Django model

So model codes is very simple

enter image description here

I executed CMD after put the above code python manage.py migrate But I get this error message

enter image description here`

  • Don't make us retype code from an image. Edit the question and add all the code, output, and error messages as plain text. – John Gordon Aug 31 '23 at 02:27
  • You need to run `python manage.py makemigrations` first like the error says? – Iain Shelvington Aug 31 '23 at 03:57
  • 1
    Looks like django is telling you exactly what to do: Run `python manage.py makemigrations` and THEN `python manage.py migrate` – Gameplay Aug 31 '23 at 06:58
  • Thanks @Gameplay I executed python manage.py makemigrations and then python manage.py migrate So It is working fine now. Thank you so much – Royal WebGuru Aug 31 '23 at 08:20

2 Answers2

1

Always after running create model in Django apply the below commands in sequence:

  1. python manage.py makemigrations
  2. python manage.py migrate
  3. python mange.py runserver

You should also add the app to INSTALLED_APPS section of settings.py file for which you are applying the migrations.

INSTALLED_APPS = [
    'myapp',        
]
Amuoeba
  • 624
  • 9
  • 28
0

As other mentioned you should copy/paste the error and not add it as a picture. You can edit your question.

As you can see in the error message, you need to create migrations (in the terminal you type: python manage.py makemigrations) then you'll need to run them (with python manage.py migrate) then you'll need to restart your server with (python mange.py runserver). This should solve your issue!

alexisnsns
  • 21
  • 6