Example #1
0
from django.urls import path
from . import views
from blog.views import SignUpView, BienvenidaView, SignInView, SignOutView
from django.conf.urls import *
from django.conf import settings
from django.contrib import admin
from django.views.generic import RedirectView

urlpatterns = [
    path('', views.post_list, name='post_list'),
    path('index', views.index, name='index'),
    path('galeria', views.galeria, name='galeria'),
    path('formulario', views.formulario, name='formulario'),
    url(r'^$', BienvenidaView.as_view(), name='bienvenida'),
    url(r'^registrate/$', SignUpView.as_view(), name='sign_up'),
    url(r'^incia-sesion/$', SignInView.as_view(), name='sign_in'),
    url(r'^cerrar-sesion/$', SignOutView.as_view(), name='sign_out'),
]
Example #2
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'))
"""
from django.contrib import admin
from django.urls import path, re_path
from django.conf.urls import url
from blog.views import (MainPageView, SignUpView, LoginView, LogoutView,
                        ProfileView, NewPostView, MyDeleteView, PostView,
                        UpdatePostView)
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    path('admin/', admin.site.urls, name='admin'),
    re_path('signup', SignUpView.as_view(), name='signup'),
    re_path('login', LoginView.as_view(), name='login'),
    re_path('logout', LogoutView.as_view(), name='logout'),
    re_path('profile/', ProfileView.as_view(), name='profile'),
    re_path('newpost', NewPostView.as_view(), name='newpost'),
    re_path('posts/(?P<pid>\d+)', PostView.as_view(), name='post'),
    re_path('update_post/(?P<pk>\d+)', UpdatePostView.as_view(),
            name='update'),
    re_path(
        'delete_post/(?P<pk>\d+)', MyDeleteView.as_view(), name='delete_post'),
    url(r'^$', MainPageView.as_view(), name='index'),
    re_path('index', MainPageView.as_view()),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)