當前位置: 首頁>>代碼示例>>Python>>正文


Python settings.VERSION屬性代碼示例

本文整理匯總了Python中django.conf.settings.VERSION屬性的典型用法代碼示例。如果您正苦於以下問題:Python settings.VERSION屬性的具體用法?Python settings.VERSION怎麽用?Python settings.VERSION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在django.conf.settings的用法示例。


在下文中一共展示了settings.VERSION屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: handle

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def handle(self, *args, **options):
        """See :meth:`django.core.management.base.BaseCommand.handle`.

        This method starts the scheduler.
        """

        # Register a listener to handle clean shutdowns
        signal.signal(signal.SIGTERM, self._onsigterm)

        # Set up global shutdown
        global GLOBAL_SHUTDOWN
        GLOBAL_SHUTDOWN = self._shutdown

        logger.info('Scale Scheduler %s', settings.VERSION)

        self.run_scheduler(settings.MESOS_MASTER) 
開發者ID:ngageoint,項目名稱:scale,代碼行數:18,代碼來源:scale_scheduler.py

示例2: terms_of_service

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def terms_of_service(request):
    """
    Handles the terms of service page
    """
    return render(
        request,
        "terms_of_service.html",
        context={
            "has_zendesk_widget": True,
            "is_public": True,
            "js_settings_json": json.dumps({
                "release_version": settings.VERSION,
                "environment": settings.ENVIRONMENT,
                "sentry_dsn": settings.SENTRY_DSN,
                "user": serialize_maybe_user(request.user),
            }),
            "ga_tracking_id": "",
        }
    ) 
開發者ID:mitodl,項目名稱:micromasters,代碼行數:21,代碼來源:views.py

示例3: index

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def index(self, request: WSGIRequest) -> HttpResponse:
        """Renders the /settings page. Only admin is allowed to see this page."""
        if not self.base.user_manager.is_admin(request.user):
            raise PermissionDenied
        context = self.base.context(request)
        library_path = os.path.abspath(
            os.path.join(settings.SONGS_CACHE_DIR, "local_library")
        )
        if os.path.islink(library_path):
            context["local_library"] = os.readlink(library_path)
        else:
            context["local_library"] = "/"
        context["version"] = settings.VERSION
        return render(request, "settings.html", context) 
開發者ID:raveberry,項目名稱:raveberry,代碼行數:16,代碼來源:settings.py

示例4: version

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def version(request):
    """
    Adds version-related context variables to the context.
    """
    response = {}
    if django_settings.VERSION:
        response = {"version": django_settings.VERSION.get("version", None)}
        commit = django_settings.VERSION.get("commit")
        if commit:
            response["commit"] = commit[:7]
    return response 
開發者ID:mozilla,項目名稱:telemetry-analysis-service,代碼行數:13,代碼來源:context_processors.py

示例5: test_about_page_rendered

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def test_about_page_rendered(self):
        response = self.client.get(reverse("pages_about"))
        self.assertEqual(response.status_code, 200)
        self.assertIn("pages/about.html", [t.name for t in response.templates])
        self.assertEqual(
            response.context["admin_name"], settings.SUPPORT_NAME)
        self.assertEqual(
            response.context["admin_email"], settings.SUPPORT_EMAIL)
        self.assertEqual(
            response.context["description"], settings.INSTANCE_DESCRIPTION)
        self.assertEqual(
            response.context["version"], settings.VERSION) 
開發者ID:whitesmith,項目名稱:hawkpost,代碼行數:14,代碼來源:tests.py

示例6: get_context_data

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context["admin_name"] = settings.SUPPORT_NAME
        context["admin_email"] = settings.SUPPORT_EMAIL
        context["description"] = settings.INSTANCE_DESCRIPTION
        context["version"] = settings.VERSION
        return context 
開發者ID:whitesmith,項目名稱:hawkpost,代碼行數:9,代碼來源:views.py

示例7: mangaki_version

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def mangaki_version():
    return parse_mangaki_version(settings.VERSION) 
開發者ID:mangaki,項目名稱:mangaki,代碼行數:4,代碼來源:version.py

示例8: mangaki_revision

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def mangaki_revision():
    return parse_mangaki_revision(settings.VERSION) 
開發者ID:mangaki,項目名稱:mangaki,代碼行數:4,代碼來源:version.py

示例9: render_page

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def render_page(request, template_name, **data):
    data["patchew_version"] = settings.VERSION + try_get_git_head()
    dispatch_module_hook("render_page_hook", request=request, context_data=data)
    return render(request, template_name, context=data) 
開發者ID:patchew-project,項目名稱:patchew,代碼行數:6,代碼來源:views.py

示例10: constants

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def constants(request):
    '''
    injects certain constants form settings module
    into template context
    '''
    return {'DEBUG': settings.DEBUG,
            'DOMAIN': settings.DOMAIN,
            'API_URL': settings.API_URL,
            'STATIC_URL': settings.STATIC_URL,
            'VERSION': settings.VERSION} 
開發者ID:arecker,項目名稱:bennedetto,代碼行數:12,代碼來源:processors.py

示例11: test_semantic_version

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def test_semantic_version():
        """
        Verify that we have a semantic compatible version.
        """
        semantic_version.Version(settings.VERSION) 
開發者ID:mitodl,項目名稱:micromasters,代碼行數:7,代碼來源:test_settings.py

示例12: standard_error_page

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def standard_error_page(request, status_code, template_filename):
    """
    Returns an error page with a given template filename and provides necessary context variables
    """
    name = request.user.profile.preferred_name if not request.user.is_anonymous else ""
    authenticated = not request.user.is_anonymous
    username = get_social_username(request.user)
    response = render(
        request,
        template_filename,
        context={
            "has_zendesk_widget": True,
            "is_public": True,
            "js_settings_json": json.dumps({
                "release_version": settings.VERSION,
                "environment": settings.ENVIRONMENT,
                "sentry_dsn": settings.SENTRY_DSN,
                "user": serialize_maybe_user(request.user),
            }),
            "authenticated": authenticated,
            "name": name,
            "username": username,
            "is_staff": has_role(request.user, [Staff.ROLE_ID, Instructor.ROLE_ID]),
            "support_email": settings.EMAIL_SUPPORT,
            "sentry_dsn": settings.SENTRY_DSN,
        }
    )
    response.status_code = status_code
    return response 
開發者ID:mitodl,項目名稱:micromasters,代碼行數:31,代碼來源:views.py

示例13: get_context

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def get_context(self, request, *args, **kwargs):
        programs = Program.objects.filter(live=True).select_related('programpage').order_by("id")
        benefits_page = BenefitsPage.objects.filter(live=True).first()
        js_settings = {
            "gaTrackingID": settings.GA_TRACKING_ID,
            "host": webpack_dev_server_host(request),
            "environment": settings.ENVIRONMENT,
            "sentry_dsn": settings.SENTRY_DSN,
            "release_version": settings.VERSION
        }

        username = get_social_username(request.user)
        context = super(HomePage, self).get_context(request)

        def get_program_page(program):
            """Return a None if ProgramPage does not exist, to avoid template errors"""
            try:
                return program.programpage
            except ProgramPage.DoesNotExist:
                return None

        program_pairs = [(program, get_program_page(program)) for program in programs]
        context["programs"] = program_pairs
        context["is_public"] = True
        context["has_zendesk_widget"] = True
        context["google_maps_api"] = False
        context["authenticated"] = not request.user.is_anonymous
        context["is_staff"] = has_role(request.user, [Staff.ROLE_ID, Instructor.ROLE_ID])
        context["username"] = username
        context["js_settings_json"] = json.dumps(js_settings)
        context["title"] = self.title
        context["ga_tracking_id"] = ""
        context["coupon_code"] = get_coupon_code(request)
        context["benefits_url"] = benefits_page.get_url() if benefits_page else ""

        return context 
開發者ID:mitodl,項目名稱:micromasters,代碼行數:38,代碼來源:models.py

示例14: get_program_page_context

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def get_program_page_context(programpage, request):
    """ Get context for the program page"""
    from cms.serializers import ProgramPageSerializer

    courses_query = (
        programpage.program.course_set.all()
    )
    js_settings = {
        "gaTrackingID": settings.GA_TRACKING_ID,
        "host": webpack_dev_server_host(request),
        "environment": settings.ENVIRONMENT,
        "sentry_dsn": settings.SENTRY_DSN,
        "release_version": settings.VERSION,
        "user": serialize_maybe_user(request.user),
        "program": ProgramPageSerializer(programpage).data,
    }
    username = get_social_username(request.user)
    context = super(ProgramPage, programpage).get_context(request)

    context["is_staff"] = has_role(request.user, [Staff.ROLE_ID, Instructor.ROLE_ID])
    context["is_public"] = True
    context["has_zendesk_widget"] = True
    context["google_maps_api"] = False
    context["authenticated"] = not request.user.is_anonymous
    context["username"] = username
    context["js_settings_json"] = json.dumps(js_settings)
    context["title"] = programpage.title
    context["courses"] = courses_query
    context["ga_tracking_id"] = programpage.program.ga_tracking_id

    return context 
開發者ID:mitodl,項目名稱:micromasters,代碼行數:33,代碼來源:models.py

示例15: global_variables

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import VERSION [as 別名]
def global_variables(request):
    return {'VERSION': settings.VERSION} 
開發者ID:blackholll,項目名稱:loonflow,代碼行數:4,代碼來源:contexts.py


注:本文中的django.conf.settings.VERSION屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。