Python django.conf.settings 模块,SITE_NAME 实例源码

我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用django.conf.settings.SITE_NAME

项目:ChenBlog    作者:woodcoding    | 项目源码 | 文件源码
def all_context(request):
    """
        ???????????
    """
    nav = Nav.objects.filter(is_show=True).order_by('order')
    links = Link.objects.filter(is_show=True).order_by('order')
    categories = Category.objects.all().order_by('-order')
    tags = Tag.objects.all().order_by('-order')
    null_count = Article.objects.filter(category__isnull=True, status='p').count()
    paginate_num = settings.SITE_PAGINATE_NUM
    SITE_NAME = settings.SITE_NAME
    SITE_MASTER = settings.SITE_MASTER
    SITE_SIGNATURE = settings.SITE_SIGNATURE
    DUOSHUO_SHORT_NAME = settings.DUOSHUO_SHORT_NAME
    DUOSHUO_NEW_COMMENTS = settings.DUOSHUO_NEW_COMMENTS
    COLORTAG = settings.COLORTAG
    FRIENDLINK = settings.FRIENDLINK
    return locals()
项目:django-icekit    作者:ic-labs    | 项目源码 | 文件源码
def update_site(sender, **kwargs):
    """
    Update `Site` object matching `SITE_ID` setting with `SITE_DOMAIN` and
    `SITE_PORT` settings.
    """
    Site = apps.get_model('sites', 'Site')
    domain = settings.SITE_DOMAIN
    if settings.SITE_PORT:
        domain += ':%s' % settings.SITE_PORT
    Site.objects.update_or_create(
        pk=settings.SITE_ID,
        defaults=dict(
            domain=domain,
            name=settings.SITE_NAME))

    # We set an explicit pk instead of relying on auto-incrementation,
    # so we need to reset the database sequence.
    sequence_sql = connection.ops.sequence_reset_sql(no_style(), [Site])
    if sequence_sql:
        cursor = connection.cursor()
        for command in sequence_sql:
            cursor.execute(command)
项目:DjangoBlog    作者:liangliangyy    | 项目源码 | 文件源码
def seo_processor(requests):
    key = 'seo_processor'
    value = cache.get(key)
    if value:
        logger.info('get processor cache.')
        return value
    else:
        logger.info('set processor cache.')
        value = {
            'SITE_NAME': settings.SITE_NAME,
            'SHOW_GOOGLE_ADSENSE': settings.SHOW_GOOGLE_ADSENSE,
            'SITE_SEO_DESCRIPTION': settings.SITE_SEO_DESCRIPTION,
            'SITE_DESCRIPTION': settings.SITE_DESCRIPTION,
            'SITE_KEYWORDS': settings.SITE_SEO_KEYWORDS,
            'SITE_BASE_URL': requests.scheme + '://' + requests.get_host() + '/',
            'ARTICLE_SUB_LENGTH': settings.ARTICLE_SUB_LENGTH,
            'nav_category_list': Category.objects.all(),
            'nav_pages': Article.objects.filter(type='p', status='p'),
            # 'MAX_COMMENTID': Comment.objects.latest().pk,
            # 'MAX_ARTICLEID': Article.objects.latest().pk
        }
        cache.set(key, value, 60 * 60 * 10)
        return value
项目:Bitpoll    作者:fsinfuhh    | 项目源码 | 文件源码
def _verify_email(request, email):
    token = signing.dumps({
        'email': email,
        'username': request.user.username,
    })
    url_path = reverse('registration_change_email', args=(token,))
    link = request.build_absolute_uri(url_path)
    email_content = render_to_string('registration/email_verify.txt', {
        'username': request.user.username,
        'email': email,
        'link': link,
    })
    return _send_mail_or_error_page(_('Verify this address for %s' % settings.SITE_NAME),
                                    email_content, email, request)
项目:Bitpoll    作者:fsinfuhh    | 项目源码 | 文件源码
def _finish_account_request(request, info):
    email = info['email']
    token = signing.dumps(info)
    url_path = reverse('registration_create_account', args=(token,))
    activation_link = request.build_absolute_uri(url_path)
    email_content = render_to_string('registration/create_email.txt', {
        'activation_link': activation_link
    })
    return _send_mail_or_error_page(_('Account creation at %s' % settings.SITE_NAME),
                                    email_content, email, request)
项目:bbgo    作者:genonfire    | 项目源码 | 文件源码
def get_verification_code(request):
    """API get_verification_code"""
    email = request.POST.get('email')

    if User.objects.filter(email__iexact=email).exists():
        msg = _('E-mail exists. Why don\'t you try to find your password?')
        data = {
            'result': False,
            'msg': msg,
        }
        return JsonResponse(data, status=201)

    signer = TimestampSigner()
    value = signer.sign(email)
    subject = _('[%(site_name)s] Verification code for signing in') % {
        'site_name': settings.SITE_NAME
    }
    body = value

    try:
        send_mail(subject, body, settings.EMAIL_HOST_USER, [email], fail_silently=False)
        msg = _('Verification code sent. Please check your E-mail.')
        data = {
            'result': True,
            'msg': msg,
        }
        return JsonResponse(data, status=201)
    except SMTPException:
        return JsonResponse({'status': 'false'}, status=400)
项目:bbgo    作者:genonfire    | 项目源码 | 文件源码
def show_terms():
    """Show Terms of service and Privacy Policy"""
    return {
        "SITE_NAME": settings.SITE_NAME,
        "ADMIN_EMAIL": settings.ADMIN_EMAIL,
    }
项目:bbgo    作者:genonfire    | 项目源码 | 文件源码
def show_delete_terms():
    """Show Terms of delete profile"""
    return {
        "SITE_NAME": settings.SITE_NAME
    }
项目:bbgo    作者:genonfire    | 项目源码 | 文件源码
def global_settings(request):
    """Setting for templates"""
    return {
        'ADMIN_EMAIL': settings.ADMIN_EMAIL,
        'APP_VERSION': settings.APP_VERSION,
        'DEBUG': settings.DEBUG,
        'ENABLE_CODE_HIGHLIGHT': settings.ENABLE_CODE_HIGHLIGHT,
        'ENABLE_MARK_KEYWORD': settings.ENABLE_MARK_KEYWORD,
        'ENABLE_NICKNAME': settings.ENABLE_NICKNAME,
        'HOT_THRESHOLD': settings.HOT_THRESHOLD,
        'ID_MIN_LENGTH': settings.ID_MIN_LENGTH,
        'ID_MAX_LENGTH': settings.ID_MAX_LENGTH,
        'NICKNAME_MIN_LENGTH': settings.NICKNAME_MIN_LENGTH,
        'NICKNAME_MAX_LENGTH': settings.NICKNAME_MAX_LENGTH,
        'PORTRAIT_SIZE_LIMIT': settings.PORTRAIT_SIZE_LIMIT,
        'ENABLE_ALARM_POLLING': settings.ENABLE_ALARM_POLLING,
        'MAX_BOOKMARKS': settings.MAX_BOOKMARKS,
        'MSG_TEXT_MAX': settings.MSG_TEXT_MAX,
        'REPLY_IMAGE_AVAILABLE': settings.REPLY_IMAGE_AVAILABLE,
        'REPLY_IMAGE_SIZE_LIMIT': settings.REPLY_IMAGE_SIZE_LIMIT,
        'REPLY_TEXT_MAX': settings.REPLY_TEXT_MAX,
        'REPLY_AUTO_RENEW_MS': settings.REPLY_AUTO_RENEW_MS,
        'COMMENT_TEXT_MAX': settings.COMMENT_TEXT_MAX,
        'USERNAME_MAX': settings.USERNAME_MAX,
        'BLOG_CATEGORY': settings.BLOG_CATEGORY,
        'ENABLE_MASTERKEY': settings.ENABLE_MASTERKEY,
        'MASTERKEY_LENGTH': settings.MASTERKEY_LENGTH,
        'ENABLE_ADSENSE': settings.ENABLE_ADSENSE,
        'SITE_INFO': settings.SITE_INFO,
        'SITE_LOGO': settings.SITE_LOGO,
        'SITE_NAME': settings.SITE_NAME,
        'FB_APP_ID': settings.FB_APP_ID,
    }
项目:QProb    作者:quant-trade    | 项目源码 | 文件源码
def extra_context(request):
    cats = Category.objects.all()

    c = []
    for cat in cats:
        cats_ = {}
        cats_['cnt'] = Post.objects.filter(category=cat.title).count()
        cats_['title'] = cat.title
        cats_['slug'] = cat.slug
        if cats_['cnt'] > 0:
            c.append(cats_)

    archive = []
    years = Post.objects.dates('date', 'year')
    for year in years:
        archive.append({'year': year.year, 'cnt': Post.objects.filter(date__year=year.year).count()})

    return {'base_url': settings.BASE_URL[:-1],
            'sitename': settings.SITE_NAME,
            'cats': c,
            'keyword': settings.KEYWORD,
            'shot_site_name': settings.SHORT_SITE_NAME,
            'research_module': settings.RESEARCH_MODULE,
            'definitions_module': settings.DEFINITIONS_MODULE,
            'twitter_handle': settings.TWITTER_HANDLE,
            'facebook_handle': settings.FACEBOOK_HANDLE,
            'linkedin_handle': settings.LINKEDIN_HANDLE,
            'gplus_handle': settings.GOOGLE_PLUS_HANDLE,
            'logo_handle': settings.LOGO_HANDLE,
            'feedburner_uri': settings.FEEDBURNER_URI,
            'copyright': settings.COPYRIGHT,
            'search_title': settings.SEARCH_TITLE,
            'site_theme': settings.SITE_THEME,
            'first_page_title': settings.FIRST_PAGE_TITLE,
            'advert': settings.AD_CODE,
            'host': settings.HOST,
            'folder': settings.SITE_FOLDER,
            'years': archive,
            'mobile_app_url': settings.MOBILE_APP_URL,
            'app_name': 'aggregator' }
项目:django-icekit    作者:ic-labs    | 项目源码 | 文件源码
def environment(request=None):
    """
    Return ``COMPRESS_ENABLED``, ``SITE_NAME``, and any settings listed
    in ``ICEKIT_CONTEXT_PROCESSOR_SETTINGS`` as context.
    """
    context = {
        'COMPRESS_ENABLED': settings.COMPRESS_ENABLED,
        'SITE_NAME': settings.SITE_NAME,
    }
    for key in settings.ICEKIT_CONTEXT_PROCESSOR_SETTINGS:
        context[key] = getattr(settings, key, None)
    return context
项目:DjangoBlog    作者:liangliangyy    | 项目源码 | 文件源码
def load_breadcrumb(article):
    """
    ???????
    :param article:
    :return:
    """
    names = article.get_category_tree()

    names.append((settings.SITE_NAME, settings.SITE_URL))
    names = names[::-1]

    return {
        'names': names,
        'title': article.title
    }
项目:PyConES2017    作者:klashxx    | 项目源码 | 文件源码
def login(request):
    kwargs = {
        'template_name': 'account/login.html',
        'authentication_form': LoginForm}
    return login_view(request,
                        extra_context={'site_name': settings.SITE_NAME,
                                       'title': 'Autenticación'},
                        **kwargs)
项目:vino-django-blog    作者:wuchangfeng    | 项目源码 | 文件源码
def all_context(request):

    categories = Category.objects.all().order_by('-order')
    tags = Tag.objects.all().order_by('-order')
    null_count = Article.objects.filter(category__isnull=True, status='p').count()
    paginate_num = settings.SITE_PAGINATE_NUM
    SITE_NAME = settings.SITE_NAME
    SITE_MASTER = settings.SITE_MASTER
    SITE_SIGNATURE = settings.SITE_SIGNATURE
    DUOSHUO_SHORT_NAME = settings.DUOSHUO_SHORT_NAME
    DUOSHUO_NEW_COMMENTS = settings.DUOSHUO_NEW_COMMENTS
    COLORTAG = settings.COLORTAG
    FRIENDLINK = settings.FRIENDLINK
    return locals()