From 709152c91e841e32b784fd5fa2e6b3bb2158543a Mon Sep 17 00:00:00 2001 From: daniel ubunutowsl Date: Sat, 23 Sep 2023 17:44:04 -0300 Subject: [PATCH 1/6] feat: adicionando requirements.txt com dependencias atualizadas --- requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..810c9e1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +asgiref==3.7.2 +Django==4.2.5 +Pillow==10.0.1 +sqlparse==0.4.4 +typing_extensions==4.8.0 From 6cdcd47686ec484a9a826bb6412c84cc1fe23cb7 Mon Sep 17 00:00:00 2001 From: daniel ubunutowsl Date: Sat, 23 Sep 2023 17:47:08 -0300 Subject: [PATCH 2/6] feat: adicionado dotenv --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 810c9e1..20be3a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ asgiref==3.7.2 Django==4.2.5 Pillow==10.0.1 +python-dotenv==1.0.0 sqlparse==0.4.4 typing_extensions==4.8.0 From d19403da69562dc2e2a6ca45cd5df123d33eef5e Mon Sep 17 00:00:00 2001 From: daniel ubunutowsl Date: Sat, 23 Sep 2023 17:48:56 -0300 Subject: [PATCH 3/6] fix: ajustando gitignore para boas praticas --- .gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index a656bc9..ea3ea4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ ecommerce/settings.py +__pycache__/ +*.py[cod] +*$py.class + +# Eviroments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ \ No newline at end of file From 58c1f0c8a8e814f239fc6bd75f4a9a1cca227d88 Mon Sep 17 00:00:00 2001 From: daniel ubunutowsl Date: Sat, 23 Sep 2023 17:54:06 -0300 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20bug=20no=20inicio=20para=20usuarios?= =?UTF-8?q?=20n=C3=A3o=20cadastrados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/views.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/store/views.py b/store/views.py index 9900af1..2a132fc 100644 --- a/store/views.py +++ b/store/views.py @@ -16,15 +16,21 @@ def store(request): except: autenticado = False + produtos = Produto.objects.all() + if autenticado: clienteId = request.session['cliente'] cliente = Cliente.objects.get(id=clienteId) ordem = Ordem.objects.get(cliente=cliente, completo=False) carItens = ordem.get_car_itens - - produtos = Produto.objects.all() - context = {'produtos': produtos, - 'carItens': carItens, 'autenticado': autenticado, 'cliente': cliente} + context = { + 'produtos': produtos, + 'carItens': carItens, + 'autenticado': autenticado, + 'cliente': cliente + } + else: + context = {'produtos': produtos, 'cliente': "Você não está logado!"} return render(request, 'store/store.html', context) From bdeb357f3e4f081f707bcedaa244c298dc6e2b02 Mon Sep 17 00:00:00 2001 From: daniel ubunutowsl Date: Sat, 23 Sep 2023 17:59:48 -0300 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20adicionando=20.env=20para=20chave=20?= =?UTF-8?q?de=20seguran=C3=A7a=20do=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecommerce/settings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ecommerce/settings.py b/ecommerce/settings.py index 26a7cb1..310e6be 100644 --- a/ecommerce/settings.py +++ b/ecommerce/settings.py @@ -9,7 +9,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ - +import dotenv import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) @@ -20,7 +20,9 @@ # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'k0h)2avtf__#p+ex@*yl#y=v6cfr48(1-c7q%fh4u97#nk0r=x' + +dotenv.load_dotenv() +SECRET_KEY = os.getenv('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True From 79f1836ddb770cbfe960c7d6dea5b50f88d61e11 Mon Sep 17 00:00:00 2001 From: daniel ubunutowsl Date: Sat, 23 Sep 2023 18:03:39 -0300 Subject: [PATCH 6/6] fix: warnings de default auto fild --- ecommerce/settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ecommerce/settings.py b/ecommerce/settings.py index 310e6be..be182b8 100644 --- a/ecommerce/settings.py +++ b/ecommerce/settings.py @@ -11,6 +11,8 @@ """ import dotenv import os +from django.conf.global_settings import DEFAULT_AUTO_FIELD + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -82,6 +84,7 @@ } } +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # Password validation # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators