예제 #1
0
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.urls import url
from django.contrib import admin

from apimas_django import provider
from panoramix_django.spec import APP_CONFIG, DEPLOY_CONFIG

try:
    app_spec = provider.configure_apimas_app(APP_CONFIG)
    deployment_spec = provider.configure_spec(app_spec, DEPLOY_CONFIG)

    api_urls = provider.construct_views(deployment_spec)
except:
    import pdb
    pdb.post_mortem()

urlpatterns = [
    url(r'^admin/', admin.site.urls),
]
urlpatterns.extend(api_urls)
예제 #2
0
파일: urls.py 프로젝트: grnet/agora-sp
from django.views.generic import RedirectView
from django.views.static import serve

from agora import views as agora_views
from djoser import views as djoser_views

from apimas_django import provider
from agora.spec import APP_CONFIG

app_spec = provider.configure_apimas_app(APP_CONFIG)

config_file = os.path.join(settings.SETTINGS_DIR, 'deployment.conf')
if os.path.isfile(config_file):
    with open(config_file) as f:
        deploy_config = json.load(f)
    deployment_spec = provider.configure_spec(app_spec, deploy_config)
else:
    deployment_spec = app_spec

api_urls = provider.construct_views(deployment_spec)

urlpatterns = [
    url(r'^api/admin/?', admin.site.urls),
    url(r'^api/shibboleth$',
        agora_views.shibboleth_login,
        name='shibboleth_login'),
    url(r'^ckeditor/', include('ckeditor_uploader.urls')),
    url(r'^api/v2/auth/me/$', agora_views.CustomMe.as_view(),
        name='custom_me'),
    url(r'^api/v2/auth/', include('djoser.urls')),
    url(r'^api/v2/auth/login/$',