diff --git a/README.md b/README.md index 8b8e483..779d396 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # django-quasar-lista-compra -Lista de la compra \ No newline at end of file +Lista de la compra + +![bd.png](./readmeImgs/bd.png) + +### Proceso + +- ([Build And Deploy A REST API With Django REST Framework. Full Project Tutorial. - YouTube 00:26:15](https://youtu.be/Sjv-HTLmnB4)) \ No newline at end of file diff --git a/authentication/__init__.py b/authentication/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/authentication/admin.py b/authentication/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/authentication/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/authentication/apps.py b/authentication/apps.py new file mode 100644 index 0000000..8bab8df --- /dev/null +++ b/authentication/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class AuthenticationConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'authentication' diff --git a/authentication/migrations/__init__.py b/authentication/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/authentication/models.py b/authentication/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/authentication/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/authentication/tests.py b/authentication/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/authentication/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/authentication/urls.py b/authentication/urls.py new file mode 100644 index 0000000..8a86c17 --- /dev/null +++ b/authentication/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.HelloAuthView.as_view(), name='hello_auth'), +] diff --git a/authentication/views.py b/authentication/views.py new file mode 100644 index 0000000..38bb4e1 --- /dev/null +++ b/authentication/views.py @@ -0,0 +1,12 @@ +# from django.shortcuts import render +from rest_framework import generics, status +from rest_framework.response import Response + +# Create your views here. + + +class HelloAuthView(generics.GenericAPIView): + + def get(self, request): + return Response(data={"message": "Hello Auth"}, + status=status.HTTP_200_OK) diff --git a/comparte/__init__.py b/comparte/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/comparte/admin.py b/comparte/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/comparte/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/comparte/apps.py b/comparte/apps.py new file mode 100644 index 0000000..faa1b25 --- /dev/null +++ b/comparte/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ComparteConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'comparte' diff --git a/comparte/migrations/__init__.py b/comparte/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/comparte/models.py b/comparte/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/comparte/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/comparte/tests.py b/comparte/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/comparte/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/comparte/views.py b/comparte/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/comparte/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/compra/__init__.py b/compra/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/compra/admin.py b/compra/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/compra/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/compra/apps.py b/compra/apps.py new file mode 100644 index 0000000..9418611 --- /dev/null +++ b/compra/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class CompraConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'compra' diff --git a/compra/migrations/__init__.py b/compra/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/compra/models.py b/compra/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/compra/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/compra/tests.py b/compra/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/compra/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/compra/views.py b/compra/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/compra/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/database/bd.dia b/database/bd.dia new file mode 100644 index 0000000..863f026 --- /dev/null +++ b/database/bd.dia @@ -0,0 +1,1177 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Authentication# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #id_authentication# + + + #integer# + + + ## + + + ## + + + + + + + + + + + + + + #Email# + + + #email# + + + ## + + + ## + + + + + + + + + + + + + + #Password# + + + #password# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Lista# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #id_lista# + + + #integer# + + + ## + + + ## + + + + + + + + + + + + + + #nombre# + + + #text# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Comparte# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #id_comparte# + + + #integer# + + + ## + + + ## + + + + + + + + + + + + + + #id_auth# + + + #Authentication.id_authentication# + + + ## + + + ## + + + + + + + + + + + + + + #id_lista# + + + #Lista.id_lista# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Item# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #id_item# + + + #integer# + + + ## + + + ## + + + + + + + + + + + + + + #nombre# + + + #text# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Compra# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #id_compra# + + + #integer# + + + ## + + + ## + + + + + + + + + + + + + + #id_lista# + + + #lista.id_lista# + + + ## + + + ## + + + + + + + + + + + + + + #id_item# + + + #item.id_item# + + + ## + + + ## + + + + + + + + + + + + + + #cantidad# + + + #float# + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + ## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ## + + + ## + + + ## + + + + + + + + + + + + + + + + + diff --git a/item/__init__.py b/item/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/item/admin.py b/item/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/item/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/item/apps.py b/item/apps.py new file mode 100644 index 0000000..f290658 --- /dev/null +++ b/item/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ItemConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'item' diff --git a/item/migrations/__init__.py b/item/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/item/models.py b/item/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/item/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/item/tests.py b/item/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/item/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/item/views.py b/item/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/item/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/lista/__init__.py b/lista/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lista/admin.py b/lista/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/lista/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/lista/apps.py b/lista/apps.py new file mode 100644 index 0000000..bb3c31f --- /dev/null +++ b/lista/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ListaConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'lista' diff --git a/lista/migrations/__init__.py b/lista/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lista/models.py b/lista/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/lista/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/lista/tests.py b/lista/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/lista/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/lista/views.py b/lista/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/lista/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/listaCompra/__init__.py b/listaCompra/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/listaCompra/asgi.py b/listaCompra/asgi.py new file mode 100644 index 0000000..df6e094 --- /dev/null +++ b/listaCompra/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for listaCompra project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'listaCompra.settings') + +application = get_asgi_application() diff --git a/listaCompra/settings.py b/listaCompra/settings.py new file mode 100644 index 0000000..bd691b7 --- /dev/null +++ b/listaCompra/settings.py @@ -0,0 +1,117 @@ +from pathlib import Path +from decouple import config + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = config('SECRET_KEY') +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = config('DEBUG', cast=bool) + +ALLOWED_HOSTS = [] + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + # Mis apps + 'authentication.apps.AuthenticationConfig', + 'lista.apps.ListaConfig', + 'comparte.apps.ComparteConfig', + 'item.apps.ItemConfig', + 'compra.apps.CompraConfig', + # Terceras partes + 'rest_framework' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'listaCompra.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'listaCompra.wsgi.application' + +# Database +# https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + +# Password validation +# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': + 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': + 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': + 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': + 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +# Internationalization +# https://docs.djangoproject.com/en/4.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.1/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/listaCompra/urls.py b/listaCompra/urls.py new file mode 100644 index 0000000..714e4ca --- /dev/null +++ b/listaCompra/urls.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('auth/', include('authentication.urls')) +] diff --git a/listaCompra/wsgi.py b/listaCompra/wsgi.py new file mode 100644 index 0000000..dfe56ea --- /dev/null +++ b/listaCompra/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for listaCompra project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'listaCompra.settings') + +application = get_wsgi_application() diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..9227517 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'listaCompra.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/readmeImgs/bd.png b/readmeImgs/bd.png new file mode 100644 index 0000000..66a5ede Binary files /dev/null and b/readmeImgs/bd.png differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2f0233d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +asgiref==3.6.0 +Django==4.1.7 +djangorestframework==3.14.0 +python-decouple==3.7 +pytz==2022.7.1 +sqlparse==0.4.3