0

I have created a Django project in my Visual Studio solution. The db.sqlite3 file was also created. There are a few classes in models.py.

class Question(models.Model):
    q_id = models.IntegerField()    
    text = models.CharField(max_length=500)

class Option():
    option_num = models.IntegerField()
    text = models.CharField(max_length=1000)

When I right click on the project, there are these options - Make Migrations, Migrate & Create Superuser.
When I execute Django Make Migrations, in the terminal it says Executing manage.py makemigrations, but nothing happens.

Then I execute Migrate. It says, a command is already running.

The __init__.py isn't updated.
I also tried, executing this command in VS Terminal, but there is no response.

python manage.py makemigrations

enter image description here

1 Answer 1

0

From your code below, the Option class is not inheriting from models.Model as you'd in the Question above.

py
 class Option(models.Model):
option_num = models.IntegerField()
text = models.CharField(max_length=1000)

Looking at you app level migrations folder, I can't actually see the __init__.py. Please ensure it is there and at the app directory root.

Once you are done with the above changes, you can now run the following commands sequentially on your terminal;

bash

python manage.py makemigrations

python manage.py migrate

python manage.py runserver
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.