Error Importing Module Django.contrib.messages.storage. User Messages
Quite commonly in web applications, you need to display a one-time notification message (also known as "flash message") to the user after processing a form or some other types of user input. For this, Django provides full support for cookie- and session-based messaging, for both anonymous and authenticated users. The messages framework allows you to temporarily store messages in one request and retrieve them for display in a subsequent request (usually the next one). Every message is tagged with a specific level that determines its priority (e.g., info, warning, or error). Enabling messages¶ Messages are implemented through a middleware class and corresponding context processor. The default settings.py created by django-admin startproject already contains all the settings required to enable message functionality: 'django.contrib.messages' is in INSTALLED_APPS. MIDDLEWARE contains 'django.contrib.sessions.middleware.SessionMiddleware' and 'django.contrib.messages.middleware.MessageMiddleware'. The default storage backend relies on sessions. That's why SessionMiddleware must be enabled and appear before MessageMiddleware in MIDDLEWARE. The 'context_processors' option of the DjangoTemplates backend defined in your TEMPLATES setting contains 'django.contrib.messages.context_processors.messages'. If you don't want to use messages, you can remove 'django.contrib.messages' from your INSTALLED_APPS, the MessageMiddleware line from MIDDLEWARE, and the messages context processor from TEMPLATES. Configur
Sign in Pricing Blog Support Search GitHub This repository Watch 1 Star 1 Fork 476 sjl/django forked from dcramer/django-compositepks Code Pull requests 0 Projects 0 Pulse Graphs Permalink Branch: master Switch branches/tags Branches Tags 1.0.X 1.1.X 1.2.X master soc2009/admin-ui soc2009/http-wsgi-improvements soc2009/i18n-improvements soc2009/model-validation soc2009/multidb soc2009/test-improvements soc2010/app-loading soc2010/query-refactor soc2010/test-refactor Nothing to show 1.2.4 1.2.3 https://docs.djangoproject.com/en/1.10/ref/contrib/messages/ 1.2.2 1.2.1 1.2 1.1.3 1.1.2 1.1.1 1.1 1.0.4 1.0.3 1.0.2 1.0.1 1.0 0.96.5 0.96.4 0.96.3 0.96.2 0.96.1 0.96 0.95.4 0.95.3 0.95.2 0.95.1 0.95 0.91.3 0.91.2 0.91.1 0.91 0.90 Nothing to show Find file Copy path django/docs/ref/contrib/messages.txt Fetching contributors… Cannot retrieve contributors at this time https://github.com/sjl/django/blob/master/docs/ref/contrib/messages.txt Raw Blame History 394 lines (288 sloc) 14.2 KB ====================== The messages framework ====================== .. module:: django.contrib.messages :synopsis: Provides cookie- and session-based temporary message storage. Django provides full support for cookie- and session-based messaging, for both anonymous and authenticated clients. The messages framework allows you to temporarily store messages in one request and retrieve them for display in a subsequent request (usually the next one). Every message is tagged with a specific ``level`` that determines its priority (e.g., ``info``, ``warning``, or ``error``). .. versionadded:: 1.2 The messages framework was added. Enabling messages ================= Messages are implemented through a :doc:`middleware ` class and corresponding :doc:`context processor `. To enable message functionality, do the following: * Edit the :setting:`MIDDLEWARE_CLASSES` setting and make sure it contains ``'django.contrib.messages.middleware.MessageMiddleware'``. If you are using a :ref:`st
here for a http://stackoverflow.com/questions/17352636/error-importing-request-processor-module-django quick overview of the site Help Center Detailed http://stackoverflow.com/questions/11938164/why-dont-my-django-unittests-know-that-messagemiddleware-is-installed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting error importing ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a error importing module minute: Sign up Error importing request processor module Django up vote 5 down vote favorite While trying to configure the TEMPLATE_CONTEXT PROCESSORS in Django settings.py I am getting the following error: Exception Value: Error importing request processor module django.contrib.messages.context_processors.messagesdjango.core.context_processors: "No module named 'django.contrib.messages.context_processors.messagesdjango'; django.contrib.messages.context_processors is not a package" My TEMPLATE_CONTEXT_PROCESSORS is as follows: (Django Version: 1.5.1) TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.static", "django.core.context_processors.tz", "django.contrib.messages.context_processors.messages" "django.core.context_processors.request", ) python django share|improve this question asked Jun 27 '13 at 20:32 Sohaib 1,17611542 add a comment| 1 Answer 1 active oldest votes up vote 10 down vote accepted You're missing a comma after your inclusion of messages, between these two lines: "django.contrib.messages.context_processors.messages" "django.core.context_processors.request", Should be: "django.contrib.messages.context_processors.messages", "django.core.context_processors.request", share|improve this answer answered Jun 27
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why don't my Django unittests know that MessageMiddleware is installed? up vote 24 down vote favorite 5 I'm working on a Django project and am writing unittests for it. However, in a test, when I try and log a user in, I get this error: MessageFailure: You cannot add messages without installing django.contrib.messages.middleware.MessageMiddleware Logging in on the actual site works fine -- and a login message is displayed using the MessageMiddleware. In my tests, if I do this: from django.conf import settings print settings.MIDDLEWARE_CLASSES Then it outputs this: ('django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware') Which appears to show the MessageMiddleware is installed when tests are run. Is there an obvious step I'm missing? UPDATE After suggestions below, it does look like it's a settings thing. I currently have settings/__init__.py like this: try: from settings.development import * except ImportError: pass and settings/defaults.py containing most of the standard settings (including MIDDLEWARE_CLASSES). And then settings.development.py overrides some of those defaults like this: from defaults import * DEBUG = True # etc It looks like my dev site itself works fine, using the development settings. But although the tests seem to load the settings OK (both defaults and development) settings.DEBUG is set to False. I don't know why, or whether that's