1👍
You don’t create the tables; Django does it for you, through the migrations system.
This is all fully covered in the tutorial.
0👍
Your model classes from models.py define your tables: each model class will be transposed in a table. Each property of a model class will be a column in the corresponding table. Each instance of the model class will be a row in that table.
So when you want to create a table you define a model class in the models.py file of your app, then run
python manage.py makemigrations
which tracks the changes made to the model class and generate a migration file which contains the sql statements to be applied to the database, and then to apply them to the database, you run
python manage.py migrate
👤doru
- Pip install Django
- Django Migrate Fails due to Type Conflict
- Python – How to output matplotlib plots as images to the browser in Django
- Create template tags from the current function
- Following button on site not working
Source:stackexchange.com