2 7f_Proyecto_Web_Completo
jp.av.dev edited this page 2021-07-02 22:25:42 -04:00
This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

App Contacto

🔸 Crear app python3 manage.py startapp contacto

Exportar la vista contato desde Proyecto/ProyectoApp/views.py
a /contacto/views.py

    from django.shortcuts import render

    # Create your views here.
    def contacto(request):
        return render(request, "contacto/contacto.html")

Exportar el path desde /Proyecto/ProyectoApp/urls.py
a /contacto/urls.py

    from django.urls import path
    from . import views

    urlpatterns = [
        path('', views.contacto, name="Contacto"),
    ]

Registrar url en el proyecto
/Proyecto/urls.py

from django.contrib import admin
from django.urls import path, include


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('ProyectoWebApp.urls')),
    path('servicios/', include('servicios.urls')),
    path('blog/', include('blog.urls')),
    path('contacto/', include('contacto.urls')),
]

Registrar app en en el proyecto
Proyecto/settings.py

        INSTALLED_APPS = [
            'django.contrib.admin',
            'django.contrib.auth',
            'django.contrib.contenttypes',
            'django.contrib.sessions',
            'django.contrib.messages',
            'django.contrib.staticfiles',
            'ProyectoWebApp',
            'servicios',
            'blog',
            'contacto',
        ]