Please help: urgent deployment problem with django post office

436 views
Skip to first unread message

Sabine Maennel

unread,
Oct 2, 2014, 10:37:13 AM10/2/14
to django...@googlegroups.com
Please help! 

I want to deploy tomorrow. The problem is that django post office logs INTERNAL Errors into the the table "postoffice_emails". I do not know why. It is about some broken links. I guess I can fix the links, but still I do not want to spam my database with that sort of reporting.

This is the link to django-post-office:

These are my settings: (I just left out the secret key and the database, which is postgres.

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

DEBUG = False

TEMPLATE_DEBUG = False

ALLOWED_HOSTS = ['*']

ADMINS = (('Sabine', 'sabine....@gmail.com'),)

SITE_ID = 1

# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.admindocs',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'floppyforms',
    'crispy_forms',
    'home',
    'apps.application',
    'braces',
    'post_office',
    'model_utils',
)

MIDDLEWARE_CLASSES = (
    '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.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'netteachers.urls'

WSGI_APPLICATION = 'netteachers.wsgi.application'

# Internationalization

LANGUAGE_CODE = 'de_DE'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'htdocs', 'static')


# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(BASE_DIR, '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',
)

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'templates'),
)

CRISPY_TEMPLATE_PACK = 'bootstrap3'

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.request',
    "django.contrib.messages.context_processors.messages",
    "core.context_processors.resolvermatch",
)

#post office settings
EMAIL_BACKEND = 'post_office.EmailBackend'
# Put this in settings.py
POST_OFFICE = {
    'DEFAULT_PRIORITY': 'now'
}
# Put this in settings.py
POST_OFFICE = {
    'LOG_LEVEL': 1 # Log only failed deliveries
}



# Pyrox Email settinge
EMAIL_HOST = 'smtp.mx.pyrox.eu'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'in...@netteachers.de'
EMAIL_HOST_PASSWORD = 'coursera2014'
EMAIL_SUBJECT_PREFIX = '[netteachers.de] '
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

gettext = lambda x: x


LANGUAGES = (
    ('de', gettext('German')),
)


Thanks in advance for any hint on that problem,
         Sabine Maennel

Erik Cederstrand

unread,
Oct 2, 2014, 10:52:23 AM10/2/14
to Django Users

Den 02/10/2014 kl. 16.37 skrev Sabine Maennel <sabine....@gmail.com>:

> Please help!
>
> I want to deploy tomorrow. The problem is that django post office logs INTERNAL Errors into the the table "postoffice_emails". I do not know why. It is about some broken links. I guess I can fix the links, but still I do not want to spam my database with that sort of reporting.

... and what are the error messages you are seeing? If your app is throwing internal errors, you should see a backtrace so you can locate the problem.

Erik

Babatunde Akinyanmi

unread,
Oct 2, 2014, 1:00:48 PM10/2/14
to Django users

You should also change your email password immediately because you just exposed it to the whole world

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/B8302E65-BD02-4AA4-8032-1301BD66AD32%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

Sabine Maennel

unread,
Oct 2, 2014, 2:15:26 PM10/2/14
to django...@googlegroups.com

 Sorry your are so right. I will do that immediately. Thanks a lot.

Sabine Maennel

unread,
Oct 2, 2014, 2:25:44 PM10/2/14
to django...@googlegroups.com
Dear Erik, I do not really care about the errors. They are not so hard to fix but I do not like that they are written into my database by this app:
https://github.com/ui/django-post_office. Well maybe I should rather ask on github what to do. Thanks so for replying and giving me that idea.
     with kind regards
           Sabine Maennel

Collin Anderson

unread,
Oct 2, 2014, 2:42:19 PM10/2/14
to django...@googlegroups.com
It seems like django-post_office recommends using sentry for the errors. Getting a better feel for your situation: Why django-post_office at all? What's wrong with the error emails getting logged?

Sabine Maennel

unread,
Oct 3, 2014, 7:55:16 AM10/3/14
to django...@googlegroups.com
Hello Collins, I need post office for other purposes not for error logging. 

I worte an issue in their issue queue, this is what they wrote back:
>>As explained by @RafRaf , the emails are sent by BrokenLinkEmailsMiddleware, you can disable it insettings.py if you need to.

But my settings.py has this middleware only:
MIDDLEWARE_CLASSES = (
'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.clickjacking.XFrameOptionsMiddleware',
)

So should I remove Common Middleware for deployment. Could it be coming from that one? Can you please give me some advice, 

Thanks so much in advance!

Brad Pitcher

unread,
Oct 3, 2014, 10:06:18 AM10/3/14
to django-users
If you want to simply disable logging, you could try setting the LOG_LEVEL to 0:

POST_OFFICE = {
    'LOG_LEVEL': 0  # Don't log anything
}


--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages