I will paste full error and stack trace here.
This is occurred when I am giving "python manage.py migrate" command
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Traceback (most recent call last):
File "C:\Users\sonali_vighne\
return self.cursor.execute(sql)
File "C:\Users\sonali_vighne\
return self.cursor.execute(query, args)
File "C:\Users\sonali_vighne\
self.errorhandler(self, exc, value)
File "C:\Users\sonali_vighne\
raise errorvalue
File "C:\Users\sonali_vighne\
res = self._query(query)
File "C:\Users\sonali_vighne\
rowcount = self._do_query(q)
File "C:\Users\sonali_vighne\
db.query(q)
File "C:\Users\sonali_vighne\
_mysql.connection.query(self, query)
_mysql_exceptions.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\sonali_vighne\
editor.create_model(self.
File "C:\Users\sonali_vighne\
self.execute(sql, params or None)
File "C:\Users\sonali_vighne\
cursor.execute(sql, params)
File "C:\Users\sonali_vighne\
return super().execute(sql, params)
File "C:\Users\sonali_vighne\
return self._execute_with_wrappers(
File "C:\Users\sonali_vighne\
return executor(sql, params, many, context)
File "C:\Users\sonali_vighne\
return self.cursor.execute(sql, params)
File "C:\Users\sonali_vighne\
raise dj_exc_value.with_traceback(
File "C:\Users\sonali_vighne\
return self.cursor.execute(sql)
File "C:\Users\sonali_vighne\
return self.cursor.execute(query, args)
File "C:\Users\sonali_vighne\
self.errorhandler(self, exc, value)
File "C:\Users\sonali_vighne\
raise errorvalue
File "C:\Users\sonali_vighne\
res = self._query(query)
File "C:\Users\sonali_vighne\
rowcount = self._do_query(q)
File "C:\Users\sonali_vighne\
db.query(q)
File "C:\Users\sonali_vighne\
_mysql.connection.query(self, query)
django.db.utils.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\EclipsePython\DjangoMysql\
execute_from_command_line(sys.
File "C:\Users\sonali_vighne\
utility.execute()
File "C:\Users\sonali_vighne\
self.fetch_command(subcommand)
File "C:\Users\sonali_vighne\
self.execute(*args, **cmd_options)
File "C:\Users\sonali_vighne\
output = self.handle(*args, **options)
File "C:\Users\sonali_vighne\
res = handle_func(*args, **kwargs)
File "C:\Users\sonali_vighne\
fake_initial=fake_initial,
File "C:\Users\sonali_vighne\
self.recorder.ensure_schema()
File "C:\Users\sonali_vighne\
raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
django.db.migrations.
Finished "D:\EclipsePython\DjangoMysql\
Setting.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mysqlApp' #this is app created
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'hospital',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3306'
models.py
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=128, unique=True)
def __unicode__(self):
return self.name
class Page(models.Model):
category = models.ForeignKey(Category, on_delete=models.CASCADE,)
title = models.CharField(max_length=128)
url = models.URLField()
views = models.IntegerField()
def __unicode__(self):
return self.title
On Tuesday, August 28, 2018 at 4:31:43 PM UTC+5:30, Jason wrote:
sounds like you have some bad syntax in your models. can't diagnose any further without the code.For future reference, when you ask for help, try to give all relevant information in your question. All you give here is the error, but nothing about the code that produces it, (the models).
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/007a5f21-6b96-4dc7-a8b2-41dc3afac8c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment