Questions tagged [django-mysql]

92 questions
0
votes
0 answers

I need a simple python Django login example using database credentials

Could you please help me find an example of a simple login page where the users can be authenticated using user/password from a database postgres or mysql(I can change that afterwards from mysql to PG )? I googled for almost 1 week but wasn't able…
0
votes
0 answers

Django - MySQL (1170, "BLOB/TEXT column 'my_column' used in key specification without a key length

I've updated the Django model field from CharField to TextField. I got the below error while applying migrations in MySQL. django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'my_column' used in key specification without a key…
DilLip_Chowdary
  • 841
  • 4
  • 18
0
votes
0 answers

Syntax error in Django Mysql Migration running on Mac

Exception: ~/devel/project/project$ poetry run python manage.py migrate Operations to perform: Apply all migrations: account, admin, alerts, auth, business, chat, contact, contenttypes, critique, curriculum, django_cron, djstripe, gear, guardian,…
martincho
  • 4,517
  • 7
  • 32
  • 42
0
votes
1 answer

Efficient way to re-order objects in Django

I have written a query to re-order objects based on the values I get in the API request. Below is the sample code I have written: @action(detail=False, permission_classes=[], methods=["PUT"]) def reorder_modules(self, request, *args,…
0
votes
0 answers

Connect remote mysql to django

i have a MySQL database in cpanel and i want to connect my django project to this database when i try to connect it it show a message that i can't connect to localhost but i don't want to connect to localhost i want to connect to my remote database…
0
votes
0 answers

Django migrate from sqlite3 to mysql

I am trying to migrate my Django app from SQLite3 to MySql. I took following steps Configured a new empty database on MySql. I did not create any tables because I assumed that the tables will be created by the migrate command. Created a new user…
user1933205
  • 300
  • 4
  • 12
0
votes
1 answer

How to Load a .dump File Format Using manage.py loaddata in Django?

I have a data.dump file for mysql and am trying to use manage.py loaddatato fill my db with this data file, but getting this error: CommandError: Problem installing fixture '˜/Downloads/data': dump is not a known serialization format. Apparently…
Pooya Kamranjam
  • 355
  • 3
  • 9
0
votes
1 answer

Django Annotate ExpressionWrapper Does not Return Expected Type

I have the following models: class Creditor(models.Model): terms_of_payment = models.IntegerField( blank=False, null=False ) class Invoice(models.Model): creditor = models.ForeignKey( Creditor, …
Pooya Kamranjam
  • 355
  • 3
  • 9
0
votes
1 answer

How to prevent mySQL autoincrement from resetting in Django

I am creating a Django app where the primary keys are AutoFields. i.e. I am not manually assigning any field as primary key in my models. I need to use mySQL. I will need to export all the data to excel or perhaps another django app from time to…
0
votes
1 answer

How to use mysql-connector mysql adapter with django??/

I cannot use mysqlclient package in the hosting server because it is a shared hosting server and they would not let me have a root privilige!! so I found about the mysql-connector adapter, I guess it is developed by MySQL but I could not find anyone…
Omar Redwan
  • 135
  • 1
  • 2
  • 7
0
votes
1 answer

ValueError: source code string cannot contain null bytes in django while running python manage.py migrate after inspectdb

I connected my Django with mysql database and ran a sql script to make a database and ran migrations on my django project and I had no errors but to to use the database I had to use python manage.py inspectdb >appname/models.py , after doing this I…
0
votes
0 answers

Python - Django, Cannot install mysqlclient using pip

I'm new to Django and I'm facing some issues installing mysqlclient for my application running this command pip install mysqlclient I'm getting an error ModuleNotFoundError: No module named 'pip._internal.operations.build.wheel_legacy' Traceback…
Ali HS
  • 99
  • 1
  • 11
0
votes
1 answer

Is it possible to connect local django project to MySql running on AWS EC2? How?

What I tried: Installed the MySql server on the EC2 instance. In the security group of the instance added an inbound rule to connect over shh from all source Created a database and user Given that user all permissions using GRANT ALL PRIVILEGES ON…
0
votes
0 answers

Tables from Django packages

How you’re doing, I’m using a package in Django for Instagram API, it creates a table in the admin page with a media Id, the link, the date, and the caption. But I can’t find this table on the project, how can I use this model on a view, and display…
0
votes
1 answer

Generic way to perform CURD operation

I am new to the Django framework. I want to create generic controller which can accept body as follows { "operation":"select", "fields":["user_id","user_name","user_email"], "table":"user", "where":[ { …