本文整理汇总了Python中views.HomeView类的典型用法代码示例。如果您正苦于以下问题:Python HomeView类的具体用法?Python HomeView怎么用?Python HomeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HomeView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_that_the_batch_status_of_a_service_is_cached
def test_that_the_batch_status_of_a_service_is_cached(self):
"""
Tests the scenario when there is a response in the caching period
"""
with MockStatusService(status=200):
all_status = HomeView.check_bulk_status(
current_app.config['SYSTEMSGO_FRONT_END_SERVER_LIST']
)
for status in all_status:
self.assertEqual(status['status'], 'online')
with MockStatusService(status=400):
all_status = HomeView.check_bulk_status(
current_app.config['SYSTEMSGO_FRONT_END_SERVER_LIST']
)
for status in all_status:
self.assertEqual(status['status'], 'online')
示例2: _register_defaults
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))
示例3: test_batch_statuses
def test_batch_statuses(self):
"""
Tests that the staticmethod that tests a bulk set of services
"""
with MockStatusService(status=200):
all_status = HomeView.check_bulk_status(
current_app.config['SYSTEMSGO_FRONT_END_SERVER_LIST']
)
for status in all_status:
self.assertEqual(status['status'], 'online')
示例4: test_the_status_of_a_service
def test_the_status_of_a_service(self):
"""
Tests the staticmethod that tests if a service is available or not
"""
with MockStatusService(status=200):
for front_end in current_app.config[
'SYSTEMSGO_FRONT_END_SERVER_LIST'
]:
status = HomeView.check_status(front_end['url'])
print status, front_end['url']
self.assertEqual(status, 'online')
示例5: homeAction
def homeAction(self):
self.pyo = Server(audio="offline", nchnls=1, sr=44100).boot()
self.pyo.recordOptions(dur=5, filename=None, fileformat=0, sampletype=3)
self.config = Config()
root = Tk()
self.samples = []
self.sampleCnt = 0
self.homeView = HomeView(root, self)
self.effect1 = 'None'
self.effect2 = 'None'
self.tempo = 10
root.mainloop()
示例6: patterns
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.decorators.cache import cache_page
from views import HomeView
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^/?$', HomeView.as_view(template_name="index.html"), name='home'),
url(r'^account/', include('fiora_project.accounts.urls')),
url(r'^admin/', include(admin.site.urls)),
) + staticfiles_urlpatterns()
示例7: patterns
# -*- 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'),
)
示例8: patterns
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)
示例9: patterns
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")),
)
示例10: url
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')),
]
示例11: patterns
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)),
)
示例12: url
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')),
]
示例13: RegexConverter
# 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()) +
示例14: patterns
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}), )
示例15: patterns
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'),
)