SMTPSender拒绝/ accounts / register /

时间:2015-12-05 15:18:32

标签: python django

我尝试将django-registration redux添加到我的项目中,我有以下错误:

(554, 'sorry, mailfrom without . in domain is administratively denied', u'webmaster@localhost')

当我转到python manager.py shell并获取Site.objects.all()时,我唯一拥有example.com域名的站点。所以我有“。”。我该怎么办?我是否必须更改HostName,如果是,那么该怎么做?

我的settings.py:

Hello

我尝试add django-registration redux到我的项目,我有以下错误:

(554, 'sorry, mailfrom without . in domain is administratively denied', u'webmaster@localhost')

我的设置

    """
Django settings for MyBlog project.

Generated by 'django-admin startproject' using Django 1.8.6.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os

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


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '!)w0_&6)uw&e@t0x2r4$vu_xw8gtm@+!#+=cvor1$0#kwoqm4_'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['www.example.com']

EMAIL_HOST= 'smtp.wp.pl'
EMAIL_HOST_USER= 'maciekprince@wp.pl'
EMAIL_HOST_PASSWORD= 'gajowy7'
EMAIL_PORT= 465
EMAIL_USE_SSL= True


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'posts',
  #  'bootstrap3',
    'crispy_forms',
    'multiupload',
    'registration',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'MyBlog.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'MyBlog.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = False


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'


CRISPY_TEMPLATE_PACK = 'bootstrap3'



STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_env","static_root")

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static_pro", "my_static"),
    #'/var/www/static/',
)

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_env","media_root")

# django registration redex statics

ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
REGISTRATION_AUTO_LOGIN = True # Automatically log the user in.


EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'



SITE_ID=1

当我转到python manager.py shell并获取Site.objects.all()时,我唯一拥有example.com域名的站点。所以我有“。”。我该怎么办?我是否必须更改HostName,如果是,那么该怎么做?

1 个答案:

答案 0 :(得分:1)

您需要在设置中设置DEFAULT_FROM_EMAIL