Closed tonioo closed 7 years ago
From @stalks on November 26, 2016 21:27
Some further investigation finds a 500 error on the request
POST /quarantine/learning_recipient/ => generated 16141 bytes in 51 msecs (HTTP/1.1 500) 4 headers in 146 bytes (1 switches on core 0)
Can you activate the debug mode please? (set DEBUG to True inside settings.py and reload uwsgi) You should get a complete error. By the way, this error is not related to modoboa but to modoboa-amavis. I'll move it to the right repository.
No extra error with DEBUG set to True. I also tried loading uwsgi directly (took some work to figure out how) with honour-stdin parameter... no extra output.
That's strange... Are you using a javascript debugger?
Experiencing same 500 error with Domain/User database. Global database works fine.
@pavinjosdev I need more information to understand the issue. Could enable DEBUG more and use a javascript debugger to display the server response please ?
@tonioo hth :)
@pavinjosdev I need the content of the Response tab ;)
@tonioo Sorry about that; Response with Debug turned on.
AttributeError at /quarantine/learning_recipient/
'QuerySet' object has no attribute 'type'
Request Method: POST
Request URL: https://filter1004.mymailcheap.com/quarantine/learning_recipient/
Django Version: 1.9.12
Python Executable: /usr/bin/uwsgi-core
Python Version: 2.7.9
Python Path: ['.', '', '/var/modoboa/env/lib/python2.7', '/var/modoboa/env/lib/python2.7/plat-x86_64-linux-gnu', '/var/modoboa/env/lib/python2.7/lib-tk', '/var/modoboa/env/lib/python2.7/lib-old', '/var/modoboa/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/var/modoboa/env/local/lib/python2.7/site-packages']
Server time: Thu, 5 Jan 2017 13:57:00 +0100
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'reversion',
'rest_framework.authtoken',
'rest_framework_swagger',
'modoboa',
'modoboa.core',
'modoboa.lib',
'modoboa.admin',
'modoboa.relaydomains',
'modoboa.limits',
'modoboa_amavis',
'modoboa_pdfcredentials',
'modoboa_postfix_autoreply',
'modoboa_sievefilters',
'modoboa_stats')
Installed Middleware:
('x_forwarded_for.middleware.XForwardedForMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'modoboa.lib.middleware.AjaxLoginRedirect',
'modoboa.lib.middleware.CommonExceptionCatcher',
'modoboa.lib.middleware.RequestCatcherMiddleware')
Traceback:
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
184. return func(*args, **kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
184. return func(*args, **kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
23. return view_func(request, *args, **kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/views.py" in learning_recipient
380. form.cleaned_data["recipient"]
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/views.py" in mark_messages
353. else saclient.learn_ham(rcpt, content)
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/lib.py" in learn_ham
181. return self._learn(rcpt, msg, "ham")
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/lib.py" in _learn
147. mbox = self._get_mailbox_from_rcpt(rcpt)
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/lib.py" in _get_mailbox_from_rcpt
135. if alias.type != "alias":
Exception Type: AttributeError at /quarantine/learning_recipient/
Exception Value: 'QuerySet' object has no attribute 'type'
Request information:
GET: No GET data
POST:
ltype = u'ham'
csrfmiddlewaretoken = u'OhvJk1oYDsOY0U9ODwD3pEFG4n2B6j98'
selection = u'jacek.szymanski@oponyserwis.pl IuUlNNDcbkSz'
recipient = u'domain'
FILES: No FILES data
COOKIES:
csrftoken = 'OhvJk1oYDsOY0U9ODwD3pEFG4n2B6j98'
sessionid = 'nytlw4832jclifp3tir69ssbu0qji01a'
META:
wsgi.multiprocess = True
HTTP_REFERER = 'https://filter1004.mymailcheap.com/quarantine/'
UWSGI_SCRIPT = 'instance.wsgi:application'
SCRIPT_NAME = u''
HTTP_X_CSRFTOKEN = 'OhvJk1oYDsOY0U9ODwD3pEFG4n2B6j98'
REQUEST_METHOD = 'POST'
PATH_INFO = u'/quarantine/learning_recipient/'
HTTP_ORIGIN = 'https://filter1004.mymailcheap.com'
SERVER_PROTOCOL = 'HTTP/1.1'
QUERY_STRING = ''
CONTENT_LENGTH = '135'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
HTTP_CONNECTION = 'keep-alive'
HTTP_COOKIE = 'sessionid=nytlw4832jclifp3tir69ssbu0qji01a; csrftoken=OhvJk1oYDsOY0U9ODwD3pEFG4n2B6j98'
SERVER_NAME = 'filter1004.mymailcheap.com'
REMOTE_ADDR = '147.32.127.102'
wsgi.url_scheme = 'https'
SERVER_PORT = '443'
uwsgi.node = 'filter1004.mymailcheap.com'
DOCUMENT_ROOT = '/var/modoboa/instance'
HTTP_CONTENT_LENGTH = '135'
HTTP_X_REQUESTED_WITH = 'XMLHttpRequest'
wsgi.input = <uwsgi._Input object at 0x7f550dccca98>
HTTP_HOST = 'filter1004.mymailcheap.com'
HTTPS = 'on'
wsgi.multithread = False
HTTP_CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
REQUEST_URI = '/quarantine/learning_recipient/'
HTTP_ACCEPT = '*/*'
wsgi.version =
wsgi.run_once = False
wsgi.errors = <open file 'wsgi_errors', mode 'w' at 0x7f550dcf1540>
REMOTE_PORT = '64242'
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.8'
UWSGI_APPID = 'filter1004.mymailcheap.com|'
uwsgi.version = '2.0.7-debian'
CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
wsgi.file_wrapper = ''
CSRF_COOKIE = u'OhvJk1oYDsOY0U9ODwD3pEFG4n2B6j98'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
Settings:
Using settings module instance.settings
SECURE_REDIRECT_EXEMPT = []
SECURE_BROWSER_XSS_FILTER = False
USE_X_FORWARDED_PORT = False
USE_THOUSAND_SEPARATOR = False
CSRF_COOKIE_SECURE = False
LANGUAGE_CODE = 'en-us'
ROOT_URLCONF = 'instance.urls'
MANAGERS = []
BASE_DIR = '.'
SILENCED_SYSTEM_CHECKS = ['fields.W342']
DEFAULT_CHARSET = 'utf-8'
SWAGGER_SETTINGS = {'info': {'contact': 'contact@modoboa.com', 'description': 'Modoboa API, requires a valid token.', 'title': 'Modoboa API'}, 'doc_expansion': 'none', 'api_path': '/', 'exclude_namespaces': [], 'template_path': 'rest_framework_swagger/index.html', 'is_authenticated': False, 'permission_denied_handler': None, 'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'], 'token_type': 'Token', 'is_superuser': False, 'resource_access_handler': None, 'unauthenticated_user': 'django.contrib.auth.models.AnonymousUser', 'api_key': '', 'api_version': '1.0'}
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
STATIC_ROOT = './sitestatic'
ALLOWED_HOSTS = ['filter1004.mymailcheap.com']
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
EMAIL_SUBJECT_PREFIX = '[Django] '
SERVER_EMAIL = 'root@localhost'
PASSWORD_MIN_LENGTH = u'********************'
SECURE_HSTS_SECONDS = 0
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_NAME = 'sessionid'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
MODOBOA_APPS =
DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'modoboa', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'modoboa', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {'init_command': 'SET foreign_key_checks = 0;'}}, 'amavis': {'ENGINE': 'django.db.backends.mysql', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'amavis', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'amavis', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {'init_command': 'SET foreign_key_checks = 0;'}}}
EMAIL_SSL_KEYFILE = u'********************'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
PASSWORD_COMPLEXITY = u'********************'
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
DEFAULT_CONTENT_TYPE = 'text/html'
APPEND_SLASH = True
LOCALE_PATHS = []
DATABASE_ROUTERS = ['modoboa_amavis.dbrouter.AmavisRouter']
DEFAULT_TABLESPACE = ''
YEAR_MONTH_FORMAT = 'F Y'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
SESSION_COOKIE_PATH = '/'
EMAIL_HOST_PASSWORD = u'********************'
SECURE_CONTENT_TYPE_NOSNIFF = False
MIDDLEWARE_CLASSES =
USE_I18N = True
THOUSAND_SEPARATOR = ','
SECRET_KEY = u'********************'
MODOBOA_API_URL = u'********************'
LANGUAGE_COOKIE_NAME = 'django_language'
DEFAULT_INDEX_TABLESPACE = ''
LOGGING_CONFIG = 'logging.config.dictConfig'
TEMPLATE_LOADERS = ['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader']
FIRST_DAY_OF_WEEK = 0
WSGI_APPLICATION = 'instance.wsgi.application'
TEMPLATE_DEBUG = False
X_FRAME_OPTIONS = 'SAMEORIGIN'
CSRF_COOKIE_NAME = 'csrftoken'
FORCE_SCRIPT_NAME = None
USE_X_FORWARDED_HOST = False
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
EMAIL_TIMEOUT = None
SECURE_SSL_HOST = None
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_DOMAIN = None
FILE_CHARSET = 'utf-8'
DEBUG = True
CSRF_TRUSTED_ORIGINS = []
LANGUAGE_COOKIE_DOMAIN = None
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS =
LANGUAGES = [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]
USE_L10N = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
STATICFILES_DIRS = '/var/modoboa/env/lib/python2.7/site-packages/modoboa/bower_components'
PREPEND_WWW = False
SECURE_PROXY_SSL_HEADER = None
LANGUAGE_COOKIE_AGE = None
SESSION_COOKIE_HTTPONLY = True
DEBUG_PROPAGATE_EXCEPTIONS = False
CSRF_COOKIE_AGE = 31449600
MONTH_DAY_FORMAT = 'F j'
LOGIN_URL = '/accounts/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
TIME_FORMAT = 'P'
AUTH_USER_MODEL = 'core.User'
DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']
AUTHENTICATION_BACKENDS = 'modoboa.lib.authbackends.SimpleBackend'
AUTH_PASSWORD_VALIDATORS = u'********************'
PASSWORD_RESET_TIMEOUT_DAYS = u'********************'
SESSION_FILE_PATH = None
CACHE_MIDDLEWARE_ALIAS = 'default'
SESSION_SAVE_EVERY_REQUEST = False
NUMBER_GROUPING = 0
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_COOKIE_PATH = '/'
LOGIN_REDIRECT_URL = '/accounts/profile/'
DECIMAL_SEPARATOR = '.'
IGNORABLE_404_URLS = []
MIGRATION_MODULES = {}
TEMPLATE_STRING_IF_INVALID = ''
LOGOUT_URL = '/accounts/logout/'
EMAIL_USE_TLS = False
FIXTURE_DIRS = []
EMAIL_HOST = 'localhost'
DATE_FORMAT = 'N j, Y'
MEDIA_ROOT = './media'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
ADMINS = []
FORMAT_MODULE_PATH = None
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication',), 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',)}
MEDIA_URL = '/media/'
DATETIME_FORMAT = 'N j, Y, P'
TEMPLATE_DIRS = []
SITE_ID = 1
DISALLOWED_USER_AGENTS = []
ALLOWED_INCLUDE_ROOTS = []
LOGGING = {'loggers': {'modoboa.auth': {'handlers': ['syslog-auth', 'modoboa'], 'propagate': False, 'level': 'INFO'}, 'modoboa.admin': {'handlers': ['modoboa'], 'propagate': False, 'level': 'INFO'}}, 'version': 1, 'formatters': {'syslog': {'format': '%(name)s: %(levelname)s %(message)s'}}, 'handlers': {'syslog-auth': {'formatter': 'syslog', 'class': 'logging.handlers.SysLogHandler', 'facility': 4}, 'modoboa': {'class': 'modoboa.core.loggers.SQLHandler'}}}
SHORT_DATE_FORMAT = 'm/d/Y'
TEMPLATES = [{'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'debug': False, 'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'modoboa.core.context_processors.top_notifications']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates'}]
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
CACHE_MIDDLEWARE_KEY_PREFIX = u'********************'
SECURE_SSL_REDIRECT = False
TIME_ZONE = 'Europe/Paris'
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_SSL = False
TEMPLATE_CONTEXT_PROCESSORS = ['django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages']
SESSION_COOKIE_AGE = 1209600
SETTINGS_MODULE = 'instance.settings'
USE_ETAGS = False
LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur']
FILE_UPLOAD_TEMP_DIR = None
INTERNAL_IPS = []
STATIC_URL = '/sitestatic/'
EMAIL_PORT = 25
USE_TZ = True
SHORT_DATETIME_FORMAT = 'm/d/Y P'
TEST_NON_SERIALIZED_APPS = []
PASSWORD_HASHERS = u'********************'
ABSOLUTE_URL_OVERRIDES = {}
LANGUAGE_COOKIE_PATH = '/'
CACHE_MIDDLEWARE_SECONDS = 600
EMAIL_SSL_CERTFILE = None
CSRF_COOKIE_HTTPONLY = False
DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y']
EMAIL_HOST_USER = ''
You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.
Thank you! I just pushed a fix, could you try it please?
Applied the fix and getting "No recipient found". This is for a relay domain. Global database works fine; Domain/User database gets this error/note.
Server Response, Debug on (Status: 500 internal server error):
"No recipient found"
Looks like I haven't thought about this use case. I have to improve the way learning is done.
@pavinjosdev Could you try the fix I just pushed please?
@tonioo Getting Internal Server Error after update (global database works fine, domain database showing 500 internal server error).
Response with Debug on:
DoesNotExist at /quarantine/learning_recipient/
Policy matching query does not exist.
Request Method: POST
Request URL: https://filter1004.mymailcheap.com/quarantine/learning_recipient/
Django Version: 1.9.12
Python Executable: /usr/bin/uwsgi-core
Python Version: 2.7.9
Python Path: ['.', '', '/var/modoboa/env/lib/python2.7', '/var/modoboa/env/lib/python2.7/plat-x86_64-linux-gnu', '/var/modoboa/env/lib/python2.7/lib-tk', '/var/modoboa/env/lib/python2.7/lib-old', '/var/modoboa/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/var/modoboa/env/local/lib/python2.7/site-packages']
Server time: Mon, 23 Jan 2017 18:13:24 +0100
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'reversion',
'rest_framework.authtoken',
'rest_framework_swagger',
'modoboa',
'modoboa.core',
'modoboa.lib',
'modoboa.admin',
'modoboa.relaydomains',
'modoboa.limits',
'modoboa_amavis',
'modoboa_pdfcredentials',
'modoboa_postfix_autoreply',
'modoboa_sievefilters',
'modoboa_stats')
Installed Middleware:
('x_forwarded_for.middleware.XForwardedForMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'modoboa.lib.middleware.AjaxLoginRedirect',
'modoboa.lib.middleware.CommonExceptionCatcher',
'modoboa.lib.middleware.RequestCatcherMiddleware')
Traceback:
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
184. return func(*args, **kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
184. return func(*args, **kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
23. return view_func(request, *args, **kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/views.py" in learning_recipient
380. form.cleaned_data["recipient"]
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/views.py" in mark_messages
353. else saclient.learn_ham(rcpt, content)
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/lib.py" in learn_ham
193. return self._learn(rcpt, msg, "ham")
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/lib.py" in _learn
158. setup_manual_learning_for_domain(domain))
File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/lib.py" in setup_manual_learning_for_domain
347. policy = Policy.objects.get(policy_name=domain.name[:32])
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
122. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/var/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py" in get
387. self.model._meta.object_name
Exception Type: DoesNotExist at /quarantine/learning_recipient/
Exception Value: Policy matching query does not exist.
Request information:
GET: No GET data
POST:
ltype = u'ham'
csrfmiddlewaretoken = u'vSvrdO6q3WhtAjFtgKBBINfc3xbbeOzt'
selection = u'delti@sklepopon.com oTgduVovrmIE'
recipient = u'domain'
FILES: No FILES data
COOKIES:
csrftoken = 'vSvrdO6q3WhtAjFtgKBBINfc3xbbeOzt'
sessionid = 'e8qpu8avbf1egv5wazgiv661tpczoshu'
META:
wsgi.multiprocess = True
HTTP_REFERER = 'https://filter1004.mymailcheap.com/quarantine/'
UWSGI_SCRIPT = 'instance.wsgi:application'
SCRIPT_NAME = u''
HTTP_X_CSRFTOKEN = 'vSvrdO6q3WhtAjFtgKBBINfc3xbbeOzt'
REQUEST_METHOD = 'POST'
PATH_INFO = u'/quarantine/learning_recipient/'
HTTP_ORIGIN = 'https://filter1004.mymailcheap.com'
SERVER_PROTOCOL = 'HTTP/1.1'
QUERY_STRING = ''
CONTENT_LENGTH = '124'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
HTTP_CONNECTION = 'keep-alive'
HTTP_COOKIE = 'sessionid=e8qpu8avbf1egv5wazgiv661tpczoshu; csrftoken=vSvrdO6q3WhtAjFtgKBBINfc3xbbeOzt'
SERVER_NAME = 'filter1004.mymailcheap.com'
REMOTE_ADDR = '147.32.127.102'
wsgi.url_scheme = 'https'
SERVER_PORT = '443'
uwsgi.node = 'filter1004.mymailcheap.com'
DOCUMENT_ROOT = '/var/modoboa/instance'
HTTP_CONTENT_LENGTH = '124'
HTTP_X_REQUESTED_WITH = 'XMLHttpRequest'
wsgi.input = <uwsgi._Input object at 0x7f18fd170e88>
HTTP_HOST = 'filter1004.mymailcheap.com'
HTTPS = 'on'
wsgi.multithread = False
HTTP_CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
REQUEST_URI = '/quarantine/learning_recipient/'
HTTP_ACCEPT = '*/*'
wsgi.version =
wsgi.run_once = False
wsgi.errors = <open file 'wsgi_errors', mode 'w' at 0x7f18ff714540>
REMOTE_PORT = '54952'
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.8'
UWSGI_APPID = 'filter1004.mymailcheap.com|'
uwsgi.version = '2.0.7-debian'
CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
wsgi.file_wrapper = ''
CSRF_COOKIE = u'vSvrdO6q3WhtAjFtgKBBINfc3xbbeOzt'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
Settings:
Using settings module instance.settings
SECURE_REDIRECT_EXEMPT = []
SECURE_BROWSER_XSS_FILTER = False
USE_X_FORWARDED_PORT = False
USE_THOUSAND_SEPARATOR = False
CSRF_COOKIE_SECURE = False
LANGUAGE_CODE = 'en-us'
ROOT_URLCONF = 'instance.urls'
MANAGERS = []
BASE_DIR = '.'
SILENCED_SYSTEM_CHECKS = ['fields.W342']
DEFAULT_CHARSET = 'utf-8'
SWAGGER_SETTINGS = {'info': {'contact': 'contact@modoboa.com', 'description': 'Modoboa API, requires a valid token.', 'title': 'Modoboa API'}, 'doc_expansion': 'none', 'api_path': '/', 'exclude_namespaces': [], 'template_path': 'rest_framework_swagger/index.html', 'is_authenticated': False, 'permission_denied_handler': None, 'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'], 'token_type': 'Token', 'is_superuser': False, 'resource_access_handler': None, 'unauthenticated_user': 'django.contrib.auth.models.AnonymousUser', 'api_key': '', 'api_version': '1.0'}
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
STATIC_ROOT = './sitestatic'
ALLOWED_HOSTS = ['filter1004.mymailcheap.com']
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
EMAIL_SUBJECT_PREFIX = '[Django] '
SERVER_EMAIL = 'root@localhost'
PASSWORD_MIN_LENGTH = u'********************'
SECURE_HSTS_SECONDS = 0
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_NAME = 'sessionid'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
MODOBOA_APPS =
DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'modoboa', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'modoboa', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {'init_command': 'SET foreign_key_checks = 0;'}}, 'amavis': {'ENGINE': 'django.db.backends.mysql', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'amavis', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'amavis', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {'init_command': 'SET foreign_key_checks = 0;'}}}
EMAIL_SSL_KEYFILE = u'********************'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
PASSWORD_COMPLEXITY = u'********************'
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
DEFAULT_CONTENT_TYPE = 'text/html'
APPEND_SLASH = True
LOCALE_PATHS = []
DATABASE_ROUTERS = ['modoboa_amavis.dbrouter.AmavisRouter']
DEFAULT_TABLESPACE = ''
YEAR_MONTH_FORMAT = 'F Y'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
SESSION_COOKIE_PATH = '/'
EMAIL_HOST_PASSWORD = u'********************'
SECURE_CONTENT_TYPE_NOSNIFF = False
MIDDLEWARE_CLASSES =
USE_I18N = True
THOUSAND_SEPARATOR = ','
SECRET_KEY = u'********************'
MODOBOA_API_URL = u'********************'
LANGUAGE_COOKIE_NAME = 'django_language'
DEFAULT_INDEX_TABLESPACE = ''
LOGGING_CONFIG = 'logging.config.dictConfig'
TEMPLATE_LOADERS = ['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader']
FIRST_DAY_OF_WEEK = 0
WSGI_APPLICATION = 'instance.wsgi.application'
TEMPLATE_DEBUG = False
X_FRAME_OPTIONS = 'SAMEORIGIN'
CSRF_COOKIE_NAME = 'csrftoken'
FORCE_SCRIPT_NAME = None
USE_X_FORWARDED_HOST = False
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
EMAIL_TIMEOUT = None
SECURE_SSL_HOST = None
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_DOMAIN = None
FILE_CHARSET = 'utf-8'
DEBUG = True
CSRF_TRUSTED_ORIGINS = []
LANGUAGE_COOKIE_DOMAIN = None
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS =
LANGUAGES = [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]
USE_L10N = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
STATICFILES_DIRS = '/var/modoboa/env/lib/python2.7/site-packages/modoboa/bower_components'
PREPEND_WWW = False
SECURE_PROXY_SSL_HEADER = None
LANGUAGE_COOKIE_AGE = None
SESSION_COOKIE_HTTPONLY = True
DEBUG_PROPAGATE_EXCEPTIONS = False
CSRF_COOKIE_AGE = 31449600
MONTH_DAY_FORMAT = 'F j'
LOGIN_URL = '/accounts/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
TIME_FORMAT = 'P'
AUTH_USER_MODEL = 'core.User'
DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']
AUTHENTICATION_BACKENDS = 'modoboa.lib.authbackends.SimpleBackend'
AUTH_PASSWORD_VALIDATORS = u'********************'
PASSWORD_RESET_TIMEOUT_DAYS = u'********************'
SESSION_FILE_PATH = None
CACHE_MIDDLEWARE_ALIAS = 'default'
SESSION_SAVE_EVERY_REQUEST = False
NUMBER_GROUPING = 0
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_COOKIE_PATH = '/'
LOGIN_REDIRECT_URL = '/accounts/profile/'
DECIMAL_SEPARATOR = '.'
IGNORABLE_404_URLS = []
MIGRATION_MODULES = {}
TEMPLATE_STRING_IF_INVALID = ''
LOGOUT_URL = '/accounts/logout/'
EMAIL_USE_TLS = False
FIXTURE_DIRS = []
EMAIL_HOST = 'localhost'
DATE_FORMAT = 'N j, Y'
MEDIA_ROOT = './media'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
ADMINS = []
FORMAT_MODULE_PATH = None
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication',), 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',)}
MEDIA_URL = '/media/'
DATETIME_FORMAT = 'N j, Y, P'
TEMPLATE_DIRS = []
SITE_ID = 1
DISALLOWED_USER_AGENTS = []
ALLOWED_INCLUDE_ROOTS = []
LOGGING = {'loggers': {'modoboa.auth': {'handlers': ['syslog-auth', 'modoboa'], 'propagate': False, 'level': 'INFO'}, 'modoboa.admin': {'handlers': ['modoboa'], 'propagate': False, 'level': 'INFO'}}, 'version': 1, 'formatters': {'syslog': {'format': '%(name)s: %(levelname)s %(message)s'}}, 'handlers': {'syslog-auth': {'formatter': 'syslog', 'class': 'logging.handlers.SysLogHandler', 'facility': 4}, 'modoboa': {'class': 'modoboa.core.loggers.SQLHandler'}}}
SHORT_DATE_FORMAT = 'm/d/Y'
TEMPLATES = [{'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'debug': False, 'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'modoboa.core.context_processors.top_notifications']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates'}]
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
CACHE_MIDDLEWARE_KEY_PREFIX = u'********************'
SECURE_SSL_REDIRECT = False
TIME_ZONE = 'Europe/Paris'
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_SSL = False
TEMPLATE_CONTEXT_PROCESSORS = ['django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages']
SESSION_COOKIE_AGE = 1209600
SETTINGS_MODULE = 'instance.settings'
USE_ETAGS = False
LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur']
FILE_UPLOAD_TEMP_DIR = None
INTERNAL_IPS = []
STATIC_URL = '/sitestatic/'
EMAIL_PORT = 25
USE_TZ = True
SHORT_DATETIME_FORMAT = 'm/d/Y P'
TEST_NON_SERIALIZED_APPS = []
PASSWORD_HASHERS = u'********************'
ABSOLUTE_URL_OVERRIDES = {}
LANGUAGE_COOKIE_PATH = '/'
CACHE_MIDDLEWARE_SECONDS = 600
EMAIL_SSL_CERTFILE = None
CSRF_COOKIE_HTTPONLY = False
DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y']
EMAIL_HOST_USER = ''
You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.
@pavinjosdev Is it better now?
Yes; working now :)
From @stalks on November 26, 2016 20:48
When I try and learn a mail using domain, the web panel doesn't respond.
When clicking Validate nothing happens. If I select global database, it will work.
Copied from original issue: tonioo/modoboa#976