django connection code example
Example 1: django mysql settings
#add this settings in settings file
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DB_NAME',
'USER': 'DB_USER',
'PASSWORD': 'DB_PASSWORD',
'HOST': 'localhost', # Or an IP Address that your DB is hosted on
'PORT': '3306',
}
}
Example 2: django swlite queries
>>> Entry.objects.filter(pub_date__lte='2006-01-01')