Ejemplo n.º 1
0
from django.conf.urls import url, include
from django.contrib import admin
from . import views
from main.views import HomePageView, UserCreateView

#urlpatterns = [
#    url(r'', views.home, name='home'),
#    url(r'', UserList.as_view() ),
#    url(r'^$', views.HomePageView.as_view(), name='home'), # Notice the URL has been named
#    url(r'^about/$', views.AboutPageView.as_view(), name='about'),
#    url(r'^data/$', views.DataPageView.as_view(), name='data'),  # Add this URL pattern
#]

urlpatterns = (
    url(r'', HomePageView.as_view(), name='homepage'),
    url(r'create/$', UserCreateView.as_view(), name='create_user'),
)
Ejemplo n.º 2
0
    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 an import:  from blog import urls as blog_urls
    2. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
from . import views
from main.views import HomeView
from main.views import UserCreateView, UserCreateDoneTV

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^accounts/user_list', views.user_list, name="user_list"),

    url(r'^accounts/register/$', UserCreateView.as_view(), name='register'),
    url(r'^accounts/register/done/$', UserCreateDoneTV.as_view(), name='register_done'),

    url(r'^$', HomeView.as_view(), name='home'),
    url(r'^post/', include('post.urls', namespace='post')),


] + static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
Ejemplo n.º 3
0
from django.conf.urls import url, include
from django.contrib import admin
from main.views import IndexView, UserCreateView, ProfileDetailView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^$', IndexView.as_view(), name='index_view'),
    url(r'^new_user/$', UserCreateView.as_view(), name='user_create_view'),
    url(r'^accounts/profile/(?P<pk>\d+)/$',
        ProfileDetailView.as_view(),
        name='profile_detail_view'),
]
Ejemplo n.º 4
0
    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'))
"""
# auth 추가
from django.contrib import admin
from django.urls import path
from django.conf.urls import include
# index는 대문, blog는 게시판
from main.views import index, blog, posting
# UserCreateView : 게정을 추가하는 View
# UserCreateDone : 계정 생성이 완료된 후에 보여줄 화면을 처리하는 View
from main.views import UserCreateView, UserCreateDone

urlpatterns = [
    path('admin/', admin.site.urls),
    # as_view()를 통해 index.html의 내용을 가져옵니다
    path('', index.as_view(), name='index'),
    # URL:80/blog에 접속하면 blog 페이지 + URL이름은 blog이다
    path('blog/', blog, name='blog'),
    # URL:80/blog/숫자로 접속하면 게시글-세부페이지(posting)
    path('blog/<int:pk>/', posting, name='posting'),
    
    # 인증 URL 3개 추가 
    path('accounts/', include('django.contrib.auth.urls')),
    path('accounts/register/', UserCreateView.as_view(), name='register'),
    path('accounts/register/done/', UserCreateDone.as_view(), name='register_done'),
]
Ejemplo n.º 5
0
from django.contrib import admin
from django.urls import path
from main.views import UserCreateView
from django.shortcuts import render
from django.contrib.auth.views import LoginView
from main.views import logout_view

urlpatterns = [
    path('admin/', admin.site.urls),
    path('singup', UserCreateView.as_view(), name="create_user"),
    path('', lambda request: render(request, 'index.html', {}), name="home"),
    path('login/', LoginView.as_view(), name="login"),
    path('logout/', logout_view, name="logout"),
]
Ejemplo n.º 6
0
"""django11 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
from main.views import UserCreateView, logout_view, home, secret
from django.contrib.auth.views import LoginView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', home, name='home'),
    path('secret/', secret, name='secret'),
    path('create_user/', UserCreateView.as_view(), name='create_user'),
    path('login/', LoginView.as_view(), name='login'),
    path('logout/', logout_view, name='logout'),
]