예제 #1
0
def bind_urls(app):
    ##########
    # user
    ##########
    app.add_url_rule('/ping', view_func=Ping.as_view('ping'), methods=['GET'])
    app.add_url_rule('/user/create',
                     view_func=CreateAccount.as_view('create_account'),
                     methods=['POST'])
    app.add_url_rule('/user/login',
                     view_func=Login.as_view('login'),
                     methods=['POST'])
    app.add_url_rule('/user/logout',
                     view_func=Logout.as_view('logout'),
                     methods=['POST'])
    app.add_url_rule('/user/info',
                     view_func=UserInfo.as_view('get_user_info'),
                     methods=['GET'])
    app.add_url_rule('/user/logout',
                     view_func=UserInfo.as_view('log_out'),
                     methods=['POST'])

    ##########
    # spider
    ##########
    app.add_url_rule('/spider/create_task',
                     view_func=CreateSpiderTask.as_view('create_spider_task'),
                     methods=['POST'])
    app.add_url_rule('/spider/search_task',
                     view_func=SearchSpiderTask.as_view('search_spider_task'),
                     methods=['POST'])
    app.add_url_rule(
        '/spider/search_tieba_task_result',
        view_func=GetTopicDetail.as_view('search_tieba_task_result'),
        methods=['POST'])

    ##########
    # operate log
    ##########

    app.add_url_rule('/operate_log/search',
                     view_func=OperateLog.as_view('operate_log_search'),
                     methods=['POST'])

    ##########
    # service register manager
    ##########

    app.add_url_rule('/service_manage/register_service',
                     view_func=RegisterServiceNode.as_view('register_service'),
                     methods=['POST'])
    app.add_url_rule('/service_manage/get_all_service',
                     view_func=GetAllService.as_view('get_all_service'),
                     methods=['POST'])
    app.add_url_rule('/service_manage/register_service',
                     view_func=DestroyService.as_view('destroy_service'),
                     methods=['POST'])
예제 #2
0
auth = Auth(app)


@auth.serializer
def serializer(user):
    return {'id': str(user.id), 'email': user.email, 'name': user.username}


@auth.user_loader
def user_loader(user):
    return user


from app.views import Login, Register
from app.views import Dashboard, Peoples, People
app.add_route(Login.as_view(), '/login')
app.add_route(Register.as_view(), '/signup')
app.add_route(Dashboard.as_view(), '/dashboard')
app.add_route(Peoples.as_view(), '/users')
app.add_route(People.as_view(), '/user')


@app.route('/logout', methods=['GET'])
@auth.login_required
async def logout(request):
    auth.logout_user(request)
    return redirect('/')


@app.route('/', methods=['GET'])
async def index(request):
예제 #3
0
파일: urls.py 프로젝트: dexpjar/cabd
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views

from app.views import Login, AdminLogin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^principal/', include('app.urls', namespace='principal')),
    url(r'^$', Login.as_view(), name='login'),
    url(r'^paneladmin/$', AdminLogin.as_view(), name='admin-login'),
    url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
    url(r'^logout_admin/$',
        auth_views.logout, {'next_page': '/paneladmin'},
        name='logout-admin'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(
    settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
예제 #4
0
from django.conf.urls import url, include
from django.contrib import admin
from app.views import Login, Logout, EventList

urlpatterns = [
    url(r'events/', include('app.urls')),
    url(r'accounts/logout/$', Logout.as_view(), name='logout'),
    url(r'accounts/login/$', Login.as_view(), name='login'),
    url(r'^admin/', admin.site.urls),
    url(r'^$', EventList.as_view(), name='event-list'),
    url('', include('social_django.urls', namespace='social')),
]
예제 #5
0
from django.urls import path
from app.views import Register, Login, Logout

urlpatterns = [
    path('register/', Register.as_view()),
    path('login/', Login.as_view()),
    path('logout/', Logout.as_view()),
]
예제 #6
0
from django.contrib.auth import logout
from django.contrib.auth.views import LogoutView
from django.urls import path, include, re_path

from app.views import Login, Registration, home, generate_referral_code, AccountActivation

urlpatterns = [
    path('login/', Login.as_view(), name="login"),
    path('logout/', LogoutView.as_view(), name="logout"),
    path('registration/', Registration.as_view(), name="registration"),
    path('generate_referral_code/',
         generate_referral_code,
         name="generate_referral_code"),
    path('activate_account/',
         AccountActivation.as_view(),
         name="account_activation"),
    path('', home, name="home"),
]
예제 #7
0
from django.conf.urls import url
from app.views import Login, Register, Details, Inbox, Peoples, Send
from app.rendering import home

urlpatterns = [
    url(r'^login', Login.as_view()),
    url(r'^register', Register.as_view()),
    url(r'^details', Details.as_view()),
    url(r'^inbox', Inbox.as_view()),
    url(r'^peoples', Peoples.as_view()),
    url(r'^send', Send.as_view()),
    url(r'^home', home)
]
예제 #8
0
"""Fakeinsta URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from app.views import Login

urlpatterns = [
    path('', Login.as_view()),
    path('admin/', admin.site.urls),
    path(
        'app/',
        include('app.urls'),
    )
]
예제 #9
0
from django.conf.urls import url

from app.views import (
    Register,
    Activate,
    Login,
    Profile,
    ForgotPassword,
    ChangePasswordView,
)

urlpatterns = [
    url(r'^api/user/register$', Register.as_view()),
    url(r'^api/user/activate$', Activate.as_view()),
    url(r'^api/user/login$', Login.as_view()),
    url(r'^api/user/me$', Profile.as_view()),
    url(r'^api/user/forgot-password$', ForgotPassword.as_view()),
    url(r'^api/user/change-password', ChangePasswordView.as_view()),
]
예제 #10
0
from django.urls import path

from app.views import  register, index, register2, personal, shopping_cart, roots, commodity, \
    add_commoditys, pay_all, update_commodity_information, sousuo, Login

urlpatterns = [
    path('login/', Login.as_view(), name='login'),
    path('register/', register, name='register'),
    path('register2/', register2, name='register2'),
    path('index/', index, name='index'),
    path('personal/', personal, name='personal'),
    path('shopping_cart/', shopping_cart, name='shopping_cart'),
    path('roots/', roots, name='roots'),
    path('commodity/<str:ID>/', commodity, name='commodity'),
    path('add_commoditys/<str:commodity_id>/',
         add_commoditys,
         name='add_commoditys'),
    path('pay_all/<str:sum_all>/', pay_all, name='pay_all'),
    path('update_commodity_information/<str:commodity_id>/',
         update_commodity_information,
         name='update_commodity_information'),
    path('sousuo/', sousuo, name='sousuo'),
]
예제 #11
0
"""example URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.contrib import admin

from app.views import Main, Login

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'login/', Login.as_view()),
    url(r'^$', Main.as_view()),
]
예제 #12
0
"""Portafolio_v1 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.contrib.auth.decorators import login_required
from django.contrib.auth import views
from django.urls import include
from app.views import Login, logoutUsuario

app_name = 'app'
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('app.urls', namespace='inicio')),
    path('cuentas/', include('accounts.urls', namespace='accounts')),
    path('accounts/login/', Login.as_view(), name='login'),
    path('logout/', login_required(logoutUsuario), name='logout'),
]