After connecting my django project with mysql localhost database i had created an app after that run the command python manage.py migrate then afterwards i had auto generated models.py by using command "python manage.py inspectdb login > crudapp/models.py" after that when i run the server i got this error. kindly help i had to complete my final year project.
Yes, i have to submit my final year project that is the reason it is urgent my due date is near
- moazamrana22 4 years, 10 months agowhat error you are getting.. ?. What does it mean auto generated model?
- VengatActually by using the command "python manage.py inspectdb table_name_in_database > appname/models.py" the code in the models.py was generated automatically but then when i run the command of python manage.py makemigerations and python manage.py migrate i got this error("ValueError: source code string cannot contain null bytes")
- moazamrana22 4 years, 10 months agoi am using mysql localhost by xampp my database is fine plus when i run the command python manage.py migrate after making the connection with mysql database it inserted build in 10 tables to my database but after making an app in my project and adding the name of that app in installed_aps in settings file when i run the command for migrate i got the error that i mentioned before
- moazamrana22 4 years, 10 months agomay be try delete the models.py file content and recreate the same content and save the file. i hope you are using some texteditor ,just try this and let us know
- scott 4 years, 10 months agodont create the models again.. just copy , delete & paste the content.
- scott 4 years, 10 months agoit is start working but i am getting this warning plz tell me about this too. WARNINGS: ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion,
- moazamrana22 4 years, 10 months agoit is start working but i am getting this warning plz tell me about this too. WARNINGS: ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion,
- moazamrana22 4 years, 10 months agoAwesome.. This is more related to Database issue. Please submit the new ticket , respective techions will guide you
- scott 4 years, 10 months agoAlso, if everything looks good from this ticket perspective, then close this ticket.
- scott 4 years, 10 months agoSure i will bro you guys are just amazing it took me 2 minutes to handle the issue with your help. Thanks alot.
- moazamrana22 4 years, 10 months agoWe are glad to help you. As you can always support us Donate . If you want :)
- scott 4 years, 10 months agomodels.py from __future__ import unicode_literals from django.db import models class SalesAnalysis(models.Model): sid = models.BigIntegerField(db_column='Sid', primary_key=True) # Field name made lowercase. pid = models.BigIntegerField(db_column='Pid') # Field name made lowercase. item_name = models.CharField(db_column='Item_Name', max_length=100) # Field name made lowercase. quantity_sold = models.BigIntegerField(db_column='Quantity_sold') # Field name made lowercase. price = models.DecimalField(db_column='Price', max_digits=10, decimal_places=0) # Field name made lowercase. cost = models.DecimalField(db_column='Cost', max_digits=10, decimal_places=0) # Field name made lowercase. profit = models.DecimalField(db_column='Profit', max_digits=10, decimal_places=0) # Field name made lowercase. date = models.DateField(db_column='Date') # Field name made lowercase. def __str__(self): return self.name class Meta: managed = False db_table = 'sales_analysis' unique_together = (('sid', 'pid'),)
is it something really urgent ?..Because you raised the ticket as urgent