I'm trying to upgrade a webapp called courses from Django 1.4 to 1.6 with django-registration 1.0. None of the other django-registration threads seem to have anything relating to this problem.
I'm running unit-tests via python manage.py test courses which crashes with the following trace:
> /home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/transaction.py(449)commit_on_success()
-> warnings.warn("commit_on_success is deprecated in favor of atomic.",
(Pdb) c
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/commands/test.py", line 71, in execute
super(Command, self).execute(*args, **options)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/commands/test.py", line 88, in handle
failures = test_runner.run_tests(test_labels)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/test/runner.py", line 145, in run_tests
old_config = self.setup_databases()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/test/runner.py", line 107, in setup_databases
return setup_databases(self.verbosity, self.interactive, **kwargs)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/test/runner.py", line 279, in setup_databases
verbosity, autoclobber=not interactive)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/backends/creation.py", line 339, in create_test_db
load_initial_data=False)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 284, in execute
self.validate()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name, True)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/registration/models.py", line 28, in <module>
class RegistrationManager(models.Manager):
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/registration/models.py", line 94, in RegistrationManager
create_inactive_user = transaction.commit_on_success(create_inactive_user)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/transaction.py", line 449, in commit_on_success
warnings.warn("commit_on_success is deprecated in favor of atomic.",
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.
I dropped into a pdb session from /home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/transaction.py(449)commit_on_success(). Stepping up two stack frames, this has been called from line 28 of site-packages/registration/models.py(28) -> class RegistrationManager(models.Manager)
Has anyone else tried to use django-registration 1.0 with Django 1.6 and seen this failure?
Here is the settings/ directory for reference: base.py:
# Django settings for EduDuck project.
import os
import django
from django.conf import global_settings
DEBUG = False
#get the path name to prepend to other settings
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.join(os.path.dirname(__file__),
os.path.pardir,
os.path.pardir)
# User Profile model
AUTH_PROFILE_MODULE = 'bio.Bio'
LOGIN_REDIRECT_URL = '/courses/'
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'UTC'
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-gb'
#https://docs.djangoproject.com/en/dev/ref/contrib/sites/?from=olddocs
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media/')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/var/www/static/'
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
os.path.join(SITE_ROOT, 'static/'),
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'core.context_processors.git_branch_render',
'core.context_processors.show_survey_link',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'core.middleware.TimezoneMiddleware',
)
ROOT_URLCONF = 'EduDuck.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'EduDuck.wsgi.application'
#TODO: Ensure templates aren't under docroot for production version
TEMPLATE_DIRS = (
os.path.join(SITE_ROOT, 'templates'),
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
#django-registration https://bitbucket.org/ubernostrum/django-registration
#This allows new users 7 days to activate new accounts
ACCOUNT_ACTIVATION_DAYS = 7
#Set following to False to disable registration.
REGISTRATION_OPEN = True
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
#Temporarily disabling haystack - 'six' package/bundled conflict?
#django-haystack via elasticsearch backend
#'haystack',
#following provides account activation via email via django-registration
'registration',
#eduduck apps
'courses',
'quiz',
'support',
'bio',
'interaction',
'outcome',
'attachment',
)
# See http://django-haystack.readthedocs.org/en/latest/tutorial.html#simple
# and override this in staging.py and production.py
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
#this is only here since I can't get python manage.py to read this config (handled via wsgi)
#use via python manage.py rebuild_index --using='forcron'
'forcron': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(levelname)s %(message)s'
},
'standard': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
},
#TODO uncomment when on Django 1.5
# 'require_debug_true': {
# '()': 'django.utils.log.RequireDebugTrue'
# }
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'django.utils.log.NullHandler',
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'log_file': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '/tmp/eduduck.log',
'maxBytes': 10*2**20, #10 MB
'backupCount': 5,
'formatter': 'standard',
},
'log_filedb': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '/tmp/eduduck_db.log',
'maxBytes': 10*2**20, #10 MB
'backupCount': 5,
'formatter': 'standard',
},
'console': {
'level': 'ERROR',
'class': 'logging.StreamHandler',
'formatter': 'standard',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'': {
'handlers': ['log_file', 'console'],
'level': 'DEBUG',
'propagate': True,
},
'django.db.backends': {
'handlers': ['log_filedb', 'console'],
'propagate': False,
'level': 'DEBUG',
},
}
}
and dev.py
#settings/dev.py
from .base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TEMPLATE_STRING_IF_INVALID = 'INVALID_EXPRESSION: %s'
#django-registration needs an MTA. For development just use console
#smtp is the default, so in prod.py, EMAIL_BACKEND is commented out or missing
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
#INSTALLED_APPS += ("debug_toolbar", )
#INTERNAL_IPS = ("127.0.0.1", )
#MIDDLEWARE_CLASSES += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'ed_dev',
'USER': 'ed_dev',
'PASSWORD': 'quickquackquock',
'HOST': '',
'PORT': '',
},
# following is for resyncing database on staging server (would be better to
# get python manage.py to read the staging.py config, as opposed to having this here.
# 'mysql_sync': {
# 'ENGINE': 'django.db.backends.mysql',
# 'HOST': '',
# 'NAME': 'eduduck',
# 'USER': 'put it back if you need to resync',
# 'PORT': '2369',
# 'PASSWORD': "put it back if you need to resync",
# 'OPTIONS': {
# 'init_command': 'SET storage_engine=INNODB',
# },
# },
}
#Not very secret SECRET_KEY. Just for dev. Staging and prod. use env var.
SECRET_KEY = 'paranoid'
# Fixture Directory - for development purposes, reloading test data
# after changes to models.
FIXTURE_DIRS = (
os.path.join(SITE_ROOT, 'fixtures/')
)
Thanks in advance,
I'm trying to upgrade a webapp called courses from Django 1.4 to 1.6 with django-registration 1.0. None of the other django-registration threads seem to have anything relating to this problem.
I'm running unit-tests via python manage.py test courses which crashes with the following trace:
> /home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/transaction.py(449)commit_on_success()
-> warnings.warn("commit_on_success is deprecated in favor of atomic.",
(Pdb) c
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/commands/test.py", line 71, in execute
super(Command, self).execute(*args, **options)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/commands/test.py", line 88, in handle
failures = test_runner.run_tests(test_labels)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/test/runner.py", line 145, in run_tests
old_config = self.setup_databases()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/test/runner.py", line 107, in setup_databases
return setup_databases(self.verbosity, self.interactive, **kwargs)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/test/runner.py", line 279, in setup_databases
verbosity, autoclobber=not interactive)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/backends/creation.py", line 339, in create_test_db
load_initial_data=False)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 284, in execute
self.validate()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name, True)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/registration/models.py", line 28, in <module>
class RegistrationManager(models.Manager):
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/registration/models.py", line 94, in RegistrationManager
create_inactive_user = transaction.commit_on_success(create_inactive_user)
File "/home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/transaction.py", line 449, in commit_on_success
warnings.warn("commit_on_success is deprecated in favor of atomic.",
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.
I dropped into a pdb session from /home/chris/.virtualenvs/blanket/lib/python3.3/site-packages/django/db/transaction.py(449)commit_on_success(). Stepping up two stack frames, this has been called from line 28 of site-packages/registration/models.py(28) -> class RegistrationManager(models.Manager)
Has anyone else tried to use django-registration 1.0 with Django 1.6 and seen this failure?
Here is the settings/ directory for reference: base.py:
# Django settings for EduDuck project.
import os
import django
from django.conf import global_settings
DEBUG = False
#get the path name to prepend to other settings
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.join(os.path.dirname(__file__),
os.path.pardir,
os.path.pardir)
# User Profile model
AUTH_PROFILE_MODULE = 'bio.Bio'
LOGIN_REDIRECT_URL = '/courses/'
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'UTC'
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-gb'
#https://docs.djangoproject.com/en/dev/ref/contrib/sites/?from=olddocs
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media/')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/var/www/static/'
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
os.path.join(SITE_ROOT, 'static/'),
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'core.context_processors.git_branch_render',
'core.context_processors.show_survey_link',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'core.middleware.TimezoneMiddleware',
)
ROOT_URLCONF = 'EduDuck.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'EduDuck.wsgi.application'
#TODO: Ensure templates aren't under docroot for production version
TEMPLATE_DIRS = (
os.path.join(SITE_ROOT, 'templates'),
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
#django-registration https://bitbucket.org/ubernostrum/django-registration
#This allows new users 7 days to activate new accounts
ACCOUNT_ACTIVATION_DAYS = 7
#Set following to False to disable registration.
REGISTRATION_OPEN = True
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
#Temporarily disabling haystack - 'six' package/bundled conflict?
#django-haystack via elasticsearch backend
#'haystack',
#following provides account activation via email via django-registration
'registration',
#eduduck apps
'courses',
'quiz',
'support',
'bio',
'interaction',
'outcome',
'attachment',
)
# See http://django-haystack.readthedocs.org/en/latest/tutorial.html#simple
# and override this in staging.py and production.py
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
#this is only here since I can't get python manage.py to read this config (handled via wsgi)
#use via python manage.py rebuild_index --using='forcron'
'forcron': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(levelname)s %(message)s'
},
'standard': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
},
#TODO uncomment when on Django 1.5
# 'require_debug_true': {
# '()': 'django.utils.log.RequireDebugTrue'
# }
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'django.utils.log.NullHandler',
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'log_file': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '/tmp/eduduck.log',
'maxBytes': 10*2**20, #10 MB
'backupCount': 5,
'formatter': 'standard',
},
'log_filedb': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '/tmp/eduduck_db.log',
'maxBytes': 10*2**20, #10 MB
'backupCount': 5,
'formatter': 'standard',
},
'console': {
'level': 'ERROR',
'class': 'logging.StreamHandler',
'formatter': 'standard',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'': {
'handlers': ['log_file', 'console'],
'level': 'DEBUG',
'propagate': True,
},
'django.db.backends': {
'handlers': ['log_filedb', 'console'],
'propagate': False,
'level': 'DEBUG',
},
}
}
and dev.py
#settings/dev.py
from .base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TEMPLATE_STRING_IF_INVALID = 'INVALID_EXPRESSION: %s'
#django-registration needs an MTA. For development just use console
#smtp is the default, so in prod.py, EMAIL_BACKEND is commented out or missing
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
#INSTALLED_APPS += ("debug_toolbar", )
#INTERNAL_IPS = ("127.0.0.1", )
#MIDDLEWARE_CLASSES += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'ed_dev',
'USER': 'ed_dev',
'PASSWORD': 'quickquackquock',
'HOST': '',
'PORT': '',
},
# following is for resyncing database on staging server (would be better to
# get python manage.py to read the staging.py config, as opposed to having this here.
# 'mysql_sync': {
# 'ENGINE': 'django.db.backends.mysql',
# 'HOST': '',
# 'NAME': 'eduduck',
# 'USER': 'put it back if you need to resync',
# 'PORT': '2369',
# 'PASSWORD': "put it back if you need to resync",
# 'OPTIONS': {
# 'init_command': 'SET storage_engine=INNODB',
# },
# },
}
#Not very secret SECRET_KEY. Just for dev. Staging and prod. use env var.
SECRET_KEY = 'paranoid'
# Fixture Directory - for development purposes, reloading test data
# after changes to models.
FIXTURE_DIRS = (
os.path.join(SITE_ROOT, 'fixtures/')
)
Thanks in advance,