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


Python HomeView.as_view方法代碼示例

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


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

示例1: _register_defaults

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
    def _register_defaults(self):
        """
        Registers some meta data about the Extension developers and gives the '/api' route a nice index of all
        registered blueprints.

        """
        self.app.add_url_rule("%s/" % MongoAPI.API_PREFIX, view_func=HomeView.as_view('home_page', app=self.app))
        self.app.add_url_rule("%s/" % MongoAPI.ABOUT, view_func=AboutView.as_view('about_page', app=self.app))
開發者ID:vivelohoy,項目名稱:flask-mongorest,代碼行數:10,代碼來源:flask_mongorest.py

示例2: Api

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView

from django.contrib import admin

from views import HomeView

from tastypie.api import Api
from qa.api import QAResource

v1_api = Api(api_name='v1')
v1_api.register(QAResource())


urlpatterns = patterns("",
    url(r"^$", TemplateView.as_view(template_name="homepage.html"), name="home"),
    url(r'^home/$', HomeView.as_view(), name='myHome'),
    url(r"^base/", TemplateView.as_view(template_name="base.html"), name="base"),
    url(r"^admin/", include(admin.site.urls)),
    url(r"^account/", include("account.urls")),
    url(r"^api/", include(v1_api.urls)),
)

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
開發者ID:stormhouse,項目名稱:conext,代碼行數:28,代碼來源:urls.py

示例3: url

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required

from . import views
from views import HomeView

urlpatterns = [
            url(r'^$', views.index, name='index'),
            url(r'^profile/$', login_required(HomeView.as_view(), redirect_field_name=None)),
            url(r'^login/$', views.login, name='user_login'),
            url(r'^logout/$', views.logout, name='user_logout'),
            url('', include("social.apps.django_app.urls", namespace='social')),
            ]
開發者ID:eve-online-api-challenge,項目名稱:WHturk,代碼行數:15,代碼來源:urls.py

示例4: url

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf.urls import url

from views import HomeView

urlpatterns = [
    url(r'^$', HomeView.as_view(), name='home')
]
開發者ID:yoelfme,項目名稱:todo-django-docker-compose,代碼行數:9,代碼來源:urls.py

示例5: patterns

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf.urls import patterns, include, url
from views import HomeView, CreateSuccess, ViewLicense

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', HomeView.as_view()),
    url(r'^(?P<short_url>\w{6})/$', ViewLicense.as_view(), name='view_license'),
    url(r'^success/(?P<short_url>\w{6})/$', CreateSuccess.as_view(), name='create_success'),
    url(r'^admin/', include(admin.site.urls)),
)
開發者ID:diopib,項目名稱:licenselink,代碼行數:14,代碼來源:urls.py

示例6: url

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
# -*- coding: utf-8 -*-
from django.conf.urls import url
from views import HomeView, PostDetailView, BlogsListView, BlogDetailView, CreatePostView


urlpatterns = [
    # Posts URLs
    url(r'^$', HomeView.as_view(), name='blogs_home'),
    url(r'^blogs/$', BlogsListView.as_view(), name='blogs_list'),
    url(r'^blogs/(?P<username>[\w-]+)$', BlogDetailView.as_view(), name='blog_detail'),
    url(r'^blogs/(?P<username>[\w-]+)/(?P<pk>[0-9]+)$', PostDetailView.as_view(), name='post_detail'),
    url(r'^new-post/$', CreatePostView.as_view(), name='create_post')

]
開發者ID:TimpleSoft,項目名稱:Wordplease,代碼行數:16,代碼來源:urls.py

示例7: patterns

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf import settings
from django.conf.urls import patterns, url, include
from django.contrib import admin
from django.views.generic import TemplateView

from views import HomeView, ResumeView, BioView, ContactView

admin.autodiscover()
urlpatterns = patterns('',
    url(r'^$', HomeView.as_view(), name='index'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^blog/', include('apps.blog.urls')),
    url(r'^portfolio/', include('apps.portfolio.urls')),
    url(r'^bio/$', BioView.as_view(), name='bio'),
    url(r'^resume/$', ResumeView.as_view(), name='resume'),
    url(r'^contact/$', ContactView.as_view(), name='contact'),
    url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
)

if not settings.PRODUCTION:
    urlpatterns += patterns('', (r'^files/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), )
開發者ID:cjmaynar,項目名稱:coreymaynard,代碼行數:23,代碼來源:urls.py

示例8: patterns

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static

from views import auth_tagpro, deauth_tagpro, set_flair, refresh_flair, HomeView

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', HomeView.as_view(), name="home"),
    url(r'^tp_auth/$', auth_tagpro, name="auth_tagpro"),
    url(r'^tp_logout/$', deauth_tagpro, name="deauth_tagpro"),
    url(r'^set_flair/$', set_flair, name="set_flair"),
    url(r'^refresh_flair/$', refresh_flair, name="refresh_flair"),
    url('', include('social.apps.django_app.urls', namespace='social')),
)

urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
開發者ID:GenesisTP,項目名稱:tagpro-flair-bot-django,代碼行數:21,代碼來源:urls.py

示例9: patterns

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
# -*- encoding: utf-8 -*-
"""Defines all urls conf."""
from django.conf.urls import patterns, url
from django.contrib.auth.views import login, logout
from django.contrib.auth.decorators import login_required
from views import HomeView, CommentView, RateUsView, ThanksView, VoteView, SaveVoteView, GraphicsView, ResultView

urlpatterns = patterns('',
	url(r'^login/$', login, { 'template_name': 'vote/login.html' }),
	url(r'^logout/$', logout, { 'template_name': 'vote/logout.html' }),
	url(r'^$', login_required(HomeView.as_view()), name='vote-home'),
	url(r'^comment/$', CommentView.as_view(), name='vote-comment'),
	url(r'^rateus/$', RateUsView.as_view(), name='vote-rate-us'),
	url(r'^thanks/$', ThanksView.as_view(), name='vote-thanks'),
	url(r'^search/$', login_required(VoteView.as_view()), name='vote-vote'),
	url(r'^vote/$', login_required(SaveVoteView.as_view()), name='vote-savevote'),
	url(r'^graphics/$', login_required(GraphicsView.as_view()), name='vote-graphics'),
	url(r'^result/$', login_required(ResultView.as_view()), name='vote-result'),
)
開發者ID:dairdr,項目名稱:voteapp,代碼行數:21,代碼來源:urls.py

示例10: url

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
                  AchievementDetail, OwnedAchievementDetail, HomeView

from views import PlayerCreate, GameCreate, OwnedGamePlayerCreate, OwnedGameGameCreate, \
                  AchievementCreate, OwnAchPlayerCreate, OwnAchAchCreate, AchievementGameCreate, \
                  GameReviewCreate

from views import LoginRequiredCheckIsOwnerUpdateView, LoginRequiredCheckIsOwnerDeleteView

from views import APIPlayerList,APIPlayerDetail,APIGameList,APIGameDetail, \
                  APIAchievementList,APIAchievementDetail,APIOwnedGameDetail,\
                  APIOwnedAchievementDetail

urlpatterns = [
    # Home page
    url(r'^$',
        HomeView.as_view(template_name='steamapp/home.html'),
        name = 'home'),

    #Login
     url(r'^login/$',
        login,
        name='login'),

    #Logout
    url(r'^logout/$',
        logout,
        name='logout',
        kwargs={'next_page': '/'}),

    # List Players: /steamapp/player.json
    url(r'^players(\.(?P<extension>(json|xml)))?$',
開發者ID:csanahuja,項目名稱:Projecte-SITW-STEAM,代碼行數:33,代碼來源:urls.py

示例11: patterns

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib.sitemaps.views import sitemap
from views import HomeView
from sitemaps import StaticSitemap, NewsSitemap, EventsSitemap

from django.contrib import admin
admin.autodiscover()

sitemaps = {'static': StaticSitemap,
            'news': NewsSitemap,
            'events': EventsSitemap}

urlpatterns = patterns('',
    url(r'^$',
        HomeView.as_view(template_name='pages/home.html'),
        name="home"),

    # sitemap
    url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
        name='django.contrib.sitemaps.views.sitemap'),

    # about page
    url(r'^about/$',
        TemplateView.as_view(template_name='pages/about.html'),
        name="about"),

    # flat pages
    # url(r'^pages/', include('django.contrib.flatpages.urls')),
    url(r'^pages/', include('pages.urls', namespace='pages')),
開發者ID:mooja,項目名稱:ssip209,代碼行數:32,代碼來源:urls.py

示例12: patterns

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf.urls import patterns, include, url
from views import HomeView, Profile

urlpatterns = patterns('',
    url(r'^$', HomeView.as_view(), name='reportes'),
    url(r'^perfil/(?P<id>\d+)/$', Profile.as_view(), name='profile'),
) 
開發者ID:eliezerfot123,項目名稱:SRH,代碼行數:9,代碼來源:urls.py

示例13: url

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf.urls import include, url

from views import HomeView

urlpatterns = [
    url(r'^$', HomeView.as_view(), name='reader'),
    url(r'api/', include('reader.apis')),
]
開發者ID:coderek,項目名稱:my_django,代碼行數:10,代碼來源:urls.py

示例14: RegexConverter

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
# Adds functions to be available in the jinja env
app.jinja_env.globals.update(strip_alnum=utils.remove_special_characters)


class RegexConverter(BaseConverter):

    '''Sets up regex to be used in the add_url_rule '''

    def __init__(self, url_map, *items):
        super(RegexConverter, self).__init__(url_map)
        self.regex = items[0]

app.url_map.converters['regex'] = RegexConverter


app.add_url_rule("/", view_func=HomeView.as_view('home_view'))
app.add_url_rule("/json", view_func=HomeView.as_view('home_json'))
app.add_url_rule("/xml", view_func=HomeView.as_view('home_xml'))
# /category
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()),
                 view_func=CategoryView.as_view('category_view'))
app.add_url_rule(
    '/<regex("{}"):category>/json'.format(
        utils.get_cat_regex()),
    view_func=CategoryView.as_view('category_json'))
app.add_url_rule(
    '/<regex("{}"):category>/xml'.format(
        utils.get_cat_regex()),
    view_func=CategoryView.as_view('category_xml'))
# /category/item_id
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
開發者ID:robertavram,項目名稱:Linux-Server-Configuration,代碼行數:33,代碼來源:application.py

示例15: patterns

# 需要導入模塊: from views import HomeView [as 別名]
# 或者: from views.HomeView import as_view [as 別名]
from django.conf.urls import patterns, include, url
from views import HomeView
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns(
    "",
    # Examples:
    # url(r'^$', 'ola.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r"^admin/", include(admin.site.urls)),
    (r"^accounts/login", "django.contrib.auth.views.login"),
    (r"^logout", "django.contrib.auth.views.logout_then_login"),
    url(r"^$", HomeView.as_view(), name="home_page"),
    url(r"^subscriber", include("subscriber.urls")),
    url(r"^leave", include("leave.urls")),
)
開發者ID:jkprivatelyingit,項目名稱:ola,代碼行數:20,代碼來源:urls.py


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