migrate

Python makemigrations does not work right

Python makemigrations does not work right Question: I use Django framework This is my models.py from django.db import models # Create your models here. class Destination(models.Model): name: models.CharField(max_length=100) img: models.ImageField(upload_to=’pics’) desc: models.TextField price: models.IntegerField offer: models.BooleanField(default=False) and here is my migrations folder-0001_initial.py: # Generated by Django 4.1.3 on 2022-11-17 10:17 from django.db import migrations, models …

Total answers: 1

Django migration Re-order column

Django migration Re-order column Question: I’ve been confused,if there’s any way how to order column when migrate in Django, In the first place In my case I don’t have is_person in my models then eventually I want to add is_person after paid in my models like the example below in models.py, then the problem is …

Total answers: 2

return database_name == ':memory:' or 'mode=memory' in database_name TypeError: argument of type 'WindowsPath' is not iterable

return database_name == ':memory:' or 'mode=memory' in database_name TypeError: argument of type 'WindowsPath' is not iterable Question: I am practicing Django but when I command python manage.py makemigration and python manage.py migrate then I got an error as show in the title. the full error is mentioned below: C:UsersMananpython projectsdjangoandmongonew_Socrai>python manage.py migrate Operations to perform: …

Total answers: 4

how to migrate django models to new database

how to migrate django models to new database Question: i develope a django project on my local system, and now i deployed that to a server. i used MySql as database. whenever i try to migrate my models (using python manage.py migrate or python manage.py makemigrations) to server’s new database, it shows me following error: …

Total answers: 2

Django 2.1 creates autotable

Django 2.1 creates autotable Question: I’m pretty new at Django 2.1 framework. and I am a week trying to setup the tables for my app. Settings are fine I listed my app in INSTALLED_APPS, but when I try to run manage.py migrate code it gives me one auto_table instead of the ones that was written …

Total answers: 1

Flask-Migrate "ModuleNotFoundError"

Flask-Migrate "ModuleNotFoundError" Question: I’m trying to make migrations on my Flask api based on SQLite db. Here is my project structure ├── app.py ├── blueprints ├── conf.py ├── db.sqlite ├── __init__.py ├── migrations ├── models.py └── templates Then i initialize my migrate class in the app.py from flask import Flask, jsonify, request, render_template from flask_sqlalchemy …

Total answers: 3

How to force migrations to a DB if some tables already exist in Django?

How to force migrations to a DB if some tables already exist in Django? Question: I have a Python/Django proyect. Due to some rolls back, and other mixed stuff we ended up in a kind of odd scenario. The current scenario is like this: DB has the correct tables DB can’t be rolled back or …

Total answers: 2

Django migrations error KeyError: ('list', u'user')

Django migrations error KeyError: ('list', u'user') Question: I am trying to run python manage.py migrate or python manage.py makemigrations I got this error: Running migrations: No migrations to apply. Traceback (most recent call last): File “manage.py”, line 10, in <module> execute_from_command_line(sys.argv) File “/Users/rostunov/temp/venv/lib/python2.7/site-packages/django/core/management/__init__.py”, line 353, in execute_from_command_line utility.execute() File “/Users/rostunov/temp/venv/lib/python2.7/site-packages/django/core/management/__init__.py”, line 345, in execute self.fetch_command(subcommand).run_from_argv(self.argv) …

Total answers: 11

Django – no such table exception

"no such table" exception Question: In Django I added models into models.py. After manage.py makemigrations, manage.py migrate raised this exception: django.db.utils.OperationalError: no such table: auth_test_usertranslatorprofile I removed all old migrations and run makemigrations and migrate again which seemed to work. It didn’t help because when I click User customer profiles of User translator profiles it …

Total answers: 28

Django: dependencies reference nonexistent parent node

Django: dependencies reference nonexistent parent node Question: When I run the following command python manage.py migrate I receive this error from django so can’t step forward in my practice: Traceback (most recent call last): File “manage.py”, line 10, in <module> execute_from_command_line(sys.argv) File “/home/nikhil/testWeb-devEnv/local/lib/python2.7/site-packages/django/core/management/__init__.py”, line 385, in execute_from_command_line utility.execute() File “/home/nikhil/testWeb-devEnv/local/lib/python2.7/site-packages/django/core/management/__init__.py”, line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) …

Total answers: 15