From 3b11fb3e5aa7e38a6f29f98ca76a6228d9b77851 Mon Sep 17 00:00:00 2001
From: Victor Magueta <56882461+vmagueta@users.noreply.github.com>
Date: Thu, 19 Dec 2024 10:36:48 +0000
Subject: [PATCH 1/4] reorganized the folders, created the initial setup, and
created the base html (#5)
---
Makefile | 41 ++++++
app/apps.py | 4 +-
app/models.py | 7 +-
{static => app/static/app}/css/.DS_Store | Bin
.../static/app}/css/header/header.css | 0
.../static/app}/css/main/banner.css | 0
.../static/app}/css/main/especialidades.css | 0
{static => app/static/app}/css/main/sobre.css | 0
.../static/app}/css/main/terapia.css | 0
{static => app/static/app}/css/style.css | 0
.../static/app}/css/utilidades/cores.css | 0
.../app}/css/utilidades/simpleanime.css | 0
.../static/app}/css/utilidades/utilidades.css | 0
.../app}/img/android-chrome-192x192.png | Bin
.../app}/img/android-chrome-512x512.png | Bin
{static => app/static/app}/img/anxiety 1.svg | 0
.../static/app}/img/apple-touch-icon.png | Bin
{static => app/static/app}/img/bg_sobre.svg | 0
.../static/app}/img/favicon-16x16.png | Bin
.../static/app}/img/favicon-32x32.png | Bin
{static => app/static/app}/img/favicon.ico | Bin
{static => app/static/app}/img/flor_logo.svg | 0
{static => app/static/app}/img/humanity 1.svg | 0
{static => app/static/app}/img/logo.png | Bin
{static => app/static/app}/img/logo1.png | Bin
.../static/app}/img/section_terapia.png | 0
.../static/app}/img/section_terapia.svg | 0
.../static/app}/img/site.webmanifest | 0
.../static/app}/img/sobre_kamila.svg | Bin
.../static/app}/img/sobre_rectangle.png | Bin
{static => app/static/app}/img/yoga 1.svg | 0
{static => app/static/app}/js/script.js | 0
.../static/app}/plugins/simple-anime.js | 0
app/templates/app/base.html | 65 ++++++++++
app/templates/app/blog.html | 11 ++
app/templates/app/index.html | 60 +++++++++
app/templates/app/post.html | 10 ++
app/views.py | 13 +-
kamila_project/asgi.py | 2 +-
kamila_project/settings.py | 69 +++++-----
kamila_project/urls.py | 28 +---
kamila_project/wsgi.py | 2 +-
pyproject.toml | 49 +++++++
requirements.dev.txt | 11 ++
.../app/index.html => requirements.test.txt | 0
requirements.txt | 1 +
templates/app/base.html | 121 ------------------
templates/app/blog.html | 28 ----
templates/app/post.html | 0
49 files changed, 303 insertions(+), 219 deletions(-)
create mode 100644 Makefile
rename {static => app/static/app}/css/.DS_Store (100%)
rename {static => app/static/app}/css/header/header.css (100%)
rename {static => app/static/app}/css/main/banner.css (100%)
rename {static => app/static/app}/css/main/especialidades.css (100%)
rename {static => app/static/app}/css/main/sobre.css (100%)
rename {static => app/static/app}/css/main/terapia.css (100%)
rename {static => app/static/app}/css/style.css (100%)
rename {static => app/static/app}/css/utilidades/cores.css (100%)
rename {static => app/static/app}/css/utilidades/simpleanime.css (100%)
rename {static => app/static/app}/css/utilidades/utilidades.css (100%)
rename {static => app/static/app}/img/android-chrome-192x192.png (100%)
rename {static => app/static/app}/img/android-chrome-512x512.png (100%)
rename {static => app/static/app}/img/anxiety 1.svg (100%)
rename {static => app/static/app}/img/apple-touch-icon.png (100%)
rename {static => app/static/app}/img/bg_sobre.svg (100%)
rename {static => app/static/app}/img/favicon-16x16.png (100%)
rename {static => app/static/app}/img/favicon-32x32.png (100%)
rename {static => app/static/app}/img/favicon.ico (100%)
rename {static => app/static/app}/img/flor_logo.svg (100%)
rename {static => app/static/app}/img/humanity 1.svg (100%)
rename {static => app/static/app}/img/logo.png (100%)
rename {static => app/static/app}/img/logo1.png (100%)
rename {static => app/static/app}/img/section_terapia.png (100%)
rename {static => app/static/app}/img/section_terapia.svg (100%)
rename {static => app/static/app}/img/site.webmanifest (100%)
rename {static => app/static/app}/img/sobre_kamila.svg (100%)
rename {static => app/static/app}/img/sobre_rectangle.png (100%)
rename {static => app/static/app}/img/yoga 1.svg (100%)
rename {static => app/static/app}/js/script.js (100%)
rename {static => app/static/app}/plugins/simple-anime.js (100%)
create mode 100644 app/templates/app/base.html
create mode 100644 app/templates/app/blog.html
create mode 100644 app/templates/app/index.html
create mode 100644 app/templates/app/post.html
create mode 100644 pyproject.toml
create mode 100644 requirements.dev.txt
rename templates/app/index.html => requirements.test.txt (100%)
create mode 100644 requirements.txt
delete mode 100644 templates/app/base.html
delete mode 100644 templates/app/blog.html
delete mode 100644 templates/app/post.html
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5b9ad21
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+PHONY: install run virtualenv ipython clean test pflake8 fmt lint
+
+
+install:
+ @echo "Installing for dev environment"
+ @.venv/bin/python -m pip install -e '.[test,dev]'
+
+
+virtualenv:
+ @python -m venv .venv
+
+
+run:
+ python manage.py runserver & python manage.py livereload
+
+
+ipython:
+ @.venv/bin/ipython
+
+
+lint:
+ @.venv/bin/pflake8 app kamila_project
+
+fmt:
+ @.venv/bin/isort --profile=black -m 3 app kamila_project
+ @.venv/bin/black app kamila_project
+
+clean: ## Clean unused files.
+ @find ./ -name '*.pyc' -exec rm -f {} \;
+ @find ./ -name '__pycache__' -exec rm -rf {} \;
+ @find ./ -name 'Thumbs.db' -exec rm -f {} \;
+ @find ./ -name '*~' -exec rm -f {} \;
+ @rm -rf .cache
+ @rm -rf .pytest_cache
+ @rm -rf .mypy_cache
+ @rm -rf build
+ @rm -rf dist
+ @rm -rf *.egg-info
+ @rm -rf htmlcov
+ @rm -rf .tox/
+ @rm -rf docs/_build
diff --git a/app/apps.py b/app/apps.py
index ed327d2..bcfe39b 100644
--- a/app/apps.py
+++ b/app/apps.py
@@ -2,5 +2,5 @@
class AppConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'app'
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "app"
diff --git a/app/models.py b/app/models.py
index 4fda651..87caf34 100644
--- a/app/models.py
+++ b/app/models.py
@@ -1,17 +1,16 @@
from django.db import models
from django.utils.text import slugify
+
class Post(models.Model):
title = models.CharField(max_length=200, verbose_name="Título")
slug = models.SlugField(unique=True, max_length=200)
content = models.TextField(verbose_name="Conteúdo")
created_at = models.DateTimeField(
- auto_now_add=True,
- verbose_name="Data de Criação"
+ auto_now_add=True, verbose_name="Data de Criação"
)
updated_at = models.DateTimeField(
- auto_now=True,
- verbose_name="Última atualização"
+ auto_now=True, verbose_name="Última atualização"
)
def __str__(self):
diff --git a/static/css/.DS_Store b/app/static/app/css/.DS_Store
similarity index 100%
rename from static/css/.DS_Store
rename to app/static/app/css/.DS_Store
diff --git a/static/css/header/header.css b/app/static/app/css/header/header.css
similarity index 100%
rename from static/css/header/header.css
rename to app/static/app/css/header/header.css
diff --git a/static/css/main/banner.css b/app/static/app/css/main/banner.css
similarity index 100%
rename from static/css/main/banner.css
rename to app/static/app/css/main/banner.css
diff --git a/static/css/main/especialidades.css b/app/static/app/css/main/especialidades.css
similarity index 100%
rename from static/css/main/especialidades.css
rename to app/static/app/css/main/especialidades.css
diff --git a/static/css/main/sobre.css b/app/static/app/css/main/sobre.css
similarity index 100%
rename from static/css/main/sobre.css
rename to app/static/app/css/main/sobre.css
diff --git a/static/css/main/terapia.css b/app/static/app/css/main/terapia.css
similarity index 100%
rename from static/css/main/terapia.css
rename to app/static/app/css/main/terapia.css
diff --git a/static/css/style.css b/app/static/app/css/style.css
similarity index 100%
rename from static/css/style.css
rename to app/static/app/css/style.css
diff --git a/static/css/utilidades/cores.css b/app/static/app/css/utilidades/cores.css
similarity index 100%
rename from static/css/utilidades/cores.css
rename to app/static/app/css/utilidades/cores.css
diff --git a/static/css/utilidades/simpleanime.css b/app/static/app/css/utilidades/simpleanime.css
similarity index 100%
rename from static/css/utilidades/simpleanime.css
rename to app/static/app/css/utilidades/simpleanime.css
diff --git a/static/css/utilidades/utilidades.css b/app/static/app/css/utilidades/utilidades.css
similarity index 100%
rename from static/css/utilidades/utilidades.css
rename to app/static/app/css/utilidades/utilidades.css
diff --git a/static/img/android-chrome-192x192.png b/app/static/app/img/android-chrome-192x192.png
similarity index 100%
rename from static/img/android-chrome-192x192.png
rename to app/static/app/img/android-chrome-192x192.png
diff --git a/static/img/android-chrome-512x512.png b/app/static/app/img/android-chrome-512x512.png
similarity index 100%
rename from static/img/android-chrome-512x512.png
rename to app/static/app/img/android-chrome-512x512.png
diff --git a/static/img/anxiety 1.svg b/app/static/app/img/anxiety 1.svg
similarity index 100%
rename from static/img/anxiety 1.svg
rename to app/static/app/img/anxiety 1.svg
diff --git a/static/img/apple-touch-icon.png b/app/static/app/img/apple-touch-icon.png
similarity index 100%
rename from static/img/apple-touch-icon.png
rename to app/static/app/img/apple-touch-icon.png
diff --git a/static/img/bg_sobre.svg b/app/static/app/img/bg_sobre.svg
similarity index 100%
rename from static/img/bg_sobre.svg
rename to app/static/app/img/bg_sobre.svg
diff --git a/static/img/favicon-16x16.png b/app/static/app/img/favicon-16x16.png
similarity index 100%
rename from static/img/favicon-16x16.png
rename to app/static/app/img/favicon-16x16.png
diff --git a/static/img/favicon-32x32.png b/app/static/app/img/favicon-32x32.png
similarity index 100%
rename from static/img/favicon-32x32.png
rename to app/static/app/img/favicon-32x32.png
diff --git a/static/img/favicon.ico b/app/static/app/img/favicon.ico
similarity index 100%
rename from static/img/favicon.ico
rename to app/static/app/img/favicon.ico
diff --git a/static/img/flor_logo.svg b/app/static/app/img/flor_logo.svg
similarity index 100%
rename from static/img/flor_logo.svg
rename to app/static/app/img/flor_logo.svg
diff --git a/static/img/humanity 1.svg b/app/static/app/img/humanity 1.svg
similarity index 100%
rename from static/img/humanity 1.svg
rename to app/static/app/img/humanity 1.svg
diff --git a/static/img/logo.png b/app/static/app/img/logo.png
similarity index 100%
rename from static/img/logo.png
rename to app/static/app/img/logo.png
diff --git a/static/img/logo1.png b/app/static/app/img/logo1.png
similarity index 100%
rename from static/img/logo1.png
rename to app/static/app/img/logo1.png
diff --git a/static/img/section_terapia.png b/app/static/app/img/section_terapia.png
similarity index 100%
rename from static/img/section_terapia.png
rename to app/static/app/img/section_terapia.png
diff --git a/static/img/section_terapia.svg b/app/static/app/img/section_terapia.svg
similarity index 100%
rename from static/img/section_terapia.svg
rename to app/static/app/img/section_terapia.svg
diff --git a/static/img/site.webmanifest b/app/static/app/img/site.webmanifest
similarity index 100%
rename from static/img/site.webmanifest
rename to app/static/app/img/site.webmanifest
diff --git a/static/img/sobre_kamila.svg b/app/static/app/img/sobre_kamila.svg
similarity index 100%
rename from static/img/sobre_kamila.svg
rename to app/static/app/img/sobre_kamila.svg
diff --git a/static/img/sobre_rectangle.png b/app/static/app/img/sobre_rectangle.png
similarity index 100%
rename from static/img/sobre_rectangle.png
rename to app/static/app/img/sobre_rectangle.png
diff --git a/static/img/yoga 1.svg b/app/static/app/img/yoga 1.svg
similarity index 100%
rename from static/img/yoga 1.svg
rename to app/static/app/img/yoga 1.svg
diff --git a/static/js/script.js b/app/static/app/js/script.js
similarity index 100%
rename from static/js/script.js
rename to app/static/app/js/script.js
diff --git a/static/plugins/simple-anime.js b/app/static/app/plugins/simple-anime.js
similarity index 100%
rename from static/plugins/simple-anime.js
rename to app/static/app/plugins/simple-anime.js
diff --git a/app/templates/app/base.html b/app/templates/app/base.html
new file mode 100644
index 0000000..39bff14
--- /dev/null
+++ b/app/templates/app/base.html
@@ -0,0 +1,65 @@
+{% load static %}
+
+
+
+
+
+
+
+
+ Terapia | Kamila Rodrigues
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% block main %}
+ {% endblock %}
+
+
+
+
+
+
+
diff --git a/app/templates/app/blog.html b/app/templates/app/blog.html
new file mode 100644
index 0000000..facbcfc
--- /dev/null
+++ b/app/templates/app/blog.html
@@ -0,0 +1,11 @@
+{% extends "app/base.html" %}
+{% load static %}
+{% block main %}
+
+
+
+{% endblock %}
+
diff --git a/app/templates/app/index.html b/app/templates/app/index.html
new file mode 100644
index 0000000..4d030de
--- /dev/null
+++ b/app/templates/app/index.html
@@ -0,0 +1,60 @@
+{% extends "app/base.html" %}
+{% load static %}
+{% block main %}
+
+
+
+
+
Seu bem-estar começa com um passo: cuidar de você.
+
+
+
+
+
+
+
especialidades
+
+
+
+
Bem-estar emocional
+
Cultive a harmonia interna, desenvolvendo uma maior compreensão e equilíbrio emocional.
+
+
+
+
Autocuidado
+
Desenvolva práticas terapêuticas que promovem o cuidado de si mesmo, fortalecendo sua mente.
+
+
+
+
Gestão de Ansiedade
+
Aprenda a controlar os pensamentos e sentimentos, promovendo a tranquilidade e o autocontrole.
+
+
+
+
+
+
+
+
terapia
+
A terapia é essencial para o bem-estar emocional, ajudando a lidar com desafios pessoais, promover o autoconhecimento e melhorar o equilíbrio mental. Ela oferece um espaço seguro para explorar sentimentos e fortalecer habilidades emocionais.
+
+ A terapia online traz ainda mais benefícios, pois oferece flexibilidade e acessibilidade, permitindo que você cuide da sua saúde mental de qualquer lugar, com conforto e praticidade.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
diff --git a/app/templates/app/post.html b/app/templates/app/post.html
new file mode 100644
index 0000000..61ce5b8
--- /dev/null
+++ b/app/templates/app/post.html
@@ -0,0 +1,10 @@
+{% extends "app/base.html" %}
+{% load static %}
+{% block main %}
+
+
+
+{% endblock %}
diff --git a/app/views.py b/app/views.py
index 448ef58..e6aa1cc 100644
--- a/app/views.py
+++ b/app/views.py
@@ -3,17 +3,14 @@
def base(request):
- return render(request, 'app/base.html')
-
+ return render(request, "app/base.html")
def index(request):
- return render(request, 'app/index.html')
-
+ return render(request, "app/index.html")
def blog(request):
- posts = Post.objects.all().order_by('-created_at')
- return render(request, 'app/blog.html', {'posts': posts})
-
+ posts = Post.objects.all().order_by("-created_at")
+ return render(request, "app/blog.html", {"posts": posts})
def post(request):
- return render(request, 'app/post.html')
+ return render(request, "app/post.html")
diff --git a/kamila_project/asgi.py b/kamila_project/asgi.py
index fae1bd7..d2f1944 100644
--- a/kamila_project/asgi.py
+++ b/kamila_project/asgi.py
@@ -11,6 +11,6 @@
from django.core.asgi import get_asgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kamila_project.settings')
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kamila_project.settings")
application = get_asgi_application()
diff --git a/kamila_project/settings.py b/kamila_project/settings.py
index 68e787a..efcdd55 100644
--- a/kamila_project/settings.py
+++ b/kamila_project/settings.py
@@ -20,7 +20,9 @@
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'django-insecure-x#rh2#8rd^+elv4f&c4e2rqd1#b1w^s_k19%cvv21m*1kfar@x'
+SECRET_KEY = (
+ "django-insecure-x#rh2#8rd^+elv4f&c4e2rqd1#b1w^s_k19%cvv21m*1kfar@x"
+)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -31,33 +33,33 @@
# Application definition
INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'app',
- 'livereload'
+ "django.contrib.admin",
+ "django.contrib.auth",
+ "django.contrib.contenttypes",
+ "django.contrib.sessions",
+ "django.contrib.messages",
+ "django.contrib.staticfiles",
+ "app",
+ "livereload",
]
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',
- 'livereload.middleware.LiveReloadScript'
+ "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",
+ "livereload.middleware.LiveReloadScript",
]
-ROOT_URLCONF = 'kamila_project.urls'
+ROOT_URLCONF = "kamila_project.urls"
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [BASE_DIR / "templates"], # Diretório global de templates
+ 'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -72,16 +74,16 @@
-WSGI_APPLICATION = 'kamila_project.wsgi.application'
+WSGI_APPLICATION = "kamila_project.wsgi.application"
# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': BASE_DIR / 'db.sqlite3',
+ "default": {
+ "ENGINE": "django.db.backends.sqlite3",
+ "NAME": BASE_DIR / "db.sqlite3",
}
}
@@ -91,16 +93,16 @@
AUTH_PASSWORD_VALIDATORS = [
{
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
@@ -108,9 +110,9 @@
# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/
-LANGUAGE_CODE = 'en-us'
+LANGUAGE_CODE = "en-us"
-TIME_ZONE = 'UTC'
+TIME_ZONE = "UTC"
USE_I18N = True
@@ -120,13 +122,16 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/
-STATIC_URL = '/static/'
+STATIC_URL = "/static/"
+
+STATICFILES_DIRS = [
+ BASE_DIR / "app/static",
+]
-STATICFILES_DIRS = [BASE_DIR / "static"]
STATIC_ROOT = BASE_DIR / "staticfiles"
# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
-DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
+DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
diff --git a/kamila_project/urls.py b/kamila_project/urls.py
index 6bf4a54..33c75fe 100644
--- a/kamila_project/urls.py
+++ b/kamila_project/urls.py
@@ -1,28 +1,12 @@
-"""
-URL configuration for kamila_project project.
-
-The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/5.1/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 app import views
urlpatterns = [
- path('post/', views.blog, name='post'),
- path('blog/', views.blog, name='blog'),
- path('index/', views.index, name='index'),
- path('admin/', admin.site.urls),
- path('', views.base, name='base'),
+ path("post/", views.post, name="post"),
+ path("blog/", views.blog, name="blog"),
+ path("index/", views.index, name="index"),
+ path("admin/", admin.site.urls),
+ path("", views.index, name="index"),
]
-
diff --git a/kamila_project/wsgi.py b/kamila_project/wsgi.py
index a3c86c1..a8593fb 100644
--- a/kamila_project/wsgi.py
+++ b/kamila_project/wsgi.py
@@ -11,6 +11,6 @@
from django.core.wsgi import get_wsgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kamila_project.settings')
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kamila_project.settings")
application = get_wsgi_application()
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..773f4bc
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,49 @@
+[project]
+name = "Terapeuta Kamila Rodrigues"
+version = "0.1.0"
+description = " Official website of Kamila Rodrigues, a professional therapist."
+readme = "README.md"
+requires-python = ">=3.10"
+authors = [
+ { name = "Viana Labs", email = "contacto@vianalabs.pt" }
+]
+dependencies = [
+ "flask",
+]
+
+[project.optional-dependencies]
+test = [
+ "flake8",
+ "black",
+ "isort",
+ "pytest",
+]
+
+[tool.flake8]
+exclude = [".venv", "build"]
+max-line-length = 79
+ignore = "F401, F821, E501"
+
+[tool.black]
+line-length = 79
+target-version = ["py310", "py312"]
+exclude = '''
+/(
+ \.eggs
+ | \.git
+ | \.venv
+ | _build
+ | build
+ | dist
+ | migrations
+)/
+'''
+
+[tool.isort]
+profile = "black"
+src_paths = ["app"]
+multi_line_output = 3
+line_length = 79
+force_grid_wrap = 0
+use_parentheses = true
+include_trailing_comma = true
diff --git a/requirements.dev.txt b/requirements.dev.txt
new file mode 100644
index 0000000..3b1a852
--- /dev/null
+++ b/requirements.dev.txt
@@ -0,0 +1,11 @@
+# dev dependencies
+ipython
+ipdb
+pudb
+pytest-watch
+
+# Code Quality
+flake8
+pyproject-flake8
+black
+isort
diff --git a/templates/app/index.html b/requirements.test.txt
similarity index 100%
rename from templates/app/index.html
rename to requirements.test.txt
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..d3e4ba5
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+django
diff --git a/templates/app/base.html b/templates/app/base.html
deleted file mode 100644
index 393a99f..0000000
--- a/templates/app/base.html
+++ /dev/null
@@ -1,121 +0,0 @@
-{% load static %}
-
-
-
-
-
-
-
-
- Terapia | Kamila Rodrigues
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Seu bem-estar começa com um passo: cuidar de você.
-
-
-
-
-
-
-
especialidades
-
-
-
-
Bem-estar emocional
-
Cultive a harmonia interna, desenvolvendo uma maior compreensão e equilíbrio emocional.
-
-
-
-
Autocuidado
-
Desenvolva práticas terapêuticas que promovem o cuidado de si mesmo, fortalecendo sua mente.
-
-
-
-
Gestão de Ansiedade
-
Aprenda a controlar os pensamentos e sentimentos, promovendo a tranquilidade e o autocontrole.
-
-
-
-
-
-
-
-
terapia
-
A terapia é essencial para o bem-estar emocional, ajudando a lidar com desafios pessoais, promover o autoconhecimento e melhorar o equilíbrio mental. Ela oferece um espaço seguro para explorar sentimentos e fortalecer habilidades emocionais.
-
- A terapia online traz ainda mais benefícios, pois oferece flexibilidade e acessibilidade, permitindo que você cuide da sua saúde mental de qualquer lugar, com conforto e praticidade.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% block main %}
- {% endblock main %}
-
-
-
-
-
-
diff --git a/templates/app/blog.html b/templates/app/blog.html
deleted file mode 100644
index c047ec2..0000000
--- a/templates/app/blog.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{% load static %}
-
-
-
-
-
-
- Blog - Kamila Rodrigues
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/templates/app/post.html b/templates/app/post.html
deleted file mode 100644
index e69de29..0000000
From 9ed8df3b71861c490aa444d6eca8f7013c7a1710 Mon Sep 17 00:00:00 2001
From: Victor Magueta <56882461+vmagueta@users.noreply.github.com>
Date: Thu, 19 Dec 2024 21:39:53 +0000
Subject: [PATCH 2/4] Setup (#6)
* reorganized the folders, created the initial setup, and created the base html
* added the make live command
* fixed missing the command in PHONY
---
Makefile | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 5b9ad21..ba7fbcc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-PHONY: install run virtualenv ipython clean test pflake8 fmt lint
+PHONY: install run virtualenv ipython clean test pflake8 fmt lint live
install:
@@ -10,8 +10,12 @@ virtualenv:
@python -m venv .venv
+live:
+ @python manage.py livereload
+
+
run:
- python manage.py runserver & python manage.py livereload
+ @python manage.py runserver
ipython:
From d7fb088d7052927a62ad4c59ede62a585369c353 Mon Sep 17 00:00:00 2001
From: Victor Magueta <56882461+vmagueta@users.noreply.github.com>
Date: Mon, 6 Jan 2025 14:02:32 +0000
Subject: [PATCH 3/4] Setup (#7)
* reorganized the folders, created the initial setup, and created the base html
* added the make live command
* fixed missing the command in PHONY
* Created pipeline for CI, fixed the requirements of the project and make a new test for testing CI
---
.github/workflows/main.yml | 75 ++++++++++++++++++++++++++++++++++++++
Makefile | 3 ++
app/tests.py | 11 +++++-
app/views.py | 4 ++
kamila_project/settings.py | 20 +++++-----
pyproject.toml | 3 +-
pytest.ini | 7 ++++
requirements.dev.txt | 5 +++
requirements.test.txt | 2 +
9 files changed, 117 insertions(+), 13 deletions(-)
create mode 100644 .github/workflows/main.yml
create mode 100644 pytest.ini
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..8d7dbd1
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,75 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - "main"
+ pull_request:
+ branches:
+ - "main"
+ workflow_dispatch:
+
+jobs:
+ lint:
+ strategy:
+ fail-fast: true
+ matrix:
+ python-version: ['3.12']
+ os: [ubuntu-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Cache dependencies
+ uses: actions/cache@v3
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-
+ - name: Install Project
+ run: pip install '.[test]'
+ - name: Look for style errors
+ run: pflake8 app
+ - name: Checking for importing style
+ run: isort --profile=black --check --diff app
+ - name: Look for auto format errors
+ run: black --check --diff app
+
+ tests:
+ needs: lint
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: ['3.10', '3.12']
+ os: [ubuntu-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Cache dependencies
+ uses: actions/cache@v3
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-${{ matrix.python-version }}-
+ - name: Install Project
+ run: pip install '.[test]'
+ - name: Run tests
+ run: pytest -v --forked --junitxml=test-result.xml
+ - name: Publish Test Results
+ uses: EnricoMi/publish-unit-test-result-action@v2.16.1
+ if: always()
+ with:
+ files: test-result.xml
+ check_name: Test Result (Python ${{ matrix.python-version }})
+ permissions:
+ contents: read
+ issues: read
+ checks: write
+ pull-requests: write
diff --git a/Makefile b/Makefile
index ba7fbcc..30776e6 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,9 @@ ipython:
@.venv/bin/ipython
+test:
+ @.venv/bin/pytest -vv -s
+
lint:
@.venv/bin/pflake8 app kamila_project
diff --git a/app/tests.py b/app/tests.py
index 7ce503c..d1b0f38 100644
--- a/app/tests.py
+++ b/app/tests.py
@@ -1,3 +1,12 @@
+import pytest
from django.test import TestCase
+from django.urls import reverse
-# Create your tests here.
+@pytest.mark.unit
+def test_acess_index_true(client):
+ """
+ Test if the index view returns a 200 status code when accessed.
+ """
+ url = reverse('index')
+ response = client.get(url)
+ assert response.status_code == 200
diff --git a/app/views.py b/app/views.py
index e6aa1cc..e9099eb 100644
--- a/app/views.py
+++ b/app/views.py
@@ -1,16 +1,20 @@
from django.shortcuts import render
+
from .models import Post
def base(request):
return render(request, "app/base.html")
+
def index(request):
return render(request, "app/index.html")
+
def blog(request):
posts = Post.objects.all().order_by("-created_at")
return render(request, "app/blog.html", {"posts": posts})
+
def post(request):
return render(request, "app/post.html")
diff --git a/kamila_project/settings.py b/kamila_project/settings.py
index efcdd55..a27e074 100644
--- a/kamila_project/settings.py
+++ b/kamila_project/settings.py
@@ -58,23 +58,21 @@
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',
+ "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 = "kamila_project.wsgi.application"
# Database
diff --git a/pyproject.toml b/pyproject.toml
index 773f4bc..2370fc1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,7 +8,7 @@ authors = [
{ name = "Viana Labs", email = "contacto@vianalabs.pt" }
]
dependencies = [
- "flask",
+ "django",
]
[project.optional-dependencies]
@@ -17,6 +17,7 @@ test = [
"black",
"isort",
"pytest",
+ "livereload",
]
[tool.flake8]
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 0000000..ef25417
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,7 @@
+[pytest]
+DJANGO_SETTINGS_MODULE = kamila_project.settings
+python_files = tests.py test_*.py
+
+markers =
+ unit: marks tests as unit tests
+ integration: marks tests as integration tests
diff --git a/requirements.dev.txt b/requirements.dev.txt
index 3b1a852..6ebab38 100644
--- a/requirements.dev.txt
+++ b/requirements.dev.txt
@@ -2,8 +2,13 @@
ipython
ipdb
pudb
+pytest
pytest-watch
+# auto reload
+django-livereload
+django-livereload-server
+
# Code Quality
flake8
pyproject-flake8
diff --git a/requirements.test.txt b/requirements.test.txt
index e69de29..125b460 100644
--- a/requirements.test.txt
+++ b/requirements.test.txt
@@ -0,0 +1,2 @@
+pytest
+pytest-django
From bcd83c07be6a14f169353e82898fbb63d41a3a58 Mon Sep 17 00:00:00 2001
From: Victor Magueta <56882461+vmagueta@users.noreply.github.com>
Date: Mon, 6 Jan 2025 14:13:29 +0000
Subject: [PATCH 4/4] Revert "Setup (#7)" (#8)
This reverts commit d7fb088d7052927a62ad4c59ede62a585369c353.
---
.github/workflows/main.yml | 75 --------------------------------------
Makefile | 3 --
app/tests.py | 11 +-----
app/views.py | 4 --
kamila_project/settings.py | 20 +++++-----
pyproject.toml | 3 +-
pytest.ini | 7 ----
requirements.dev.txt | 5 ---
requirements.test.txt | 2 -
9 files changed, 13 insertions(+), 117 deletions(-)
delete mode 100644 .github/workflows/main.yml
delete mode 100644 pytest.ini
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
deleted file mode 100644
index 8d7dbd1..0000000
--- a/.github/workflows/main.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-name: CI
-
-on:
- push:
- branches:
- - "main"
- pull_request:
- branches:
- - "main"
- workflow_dispatch:
-
-jobs:
- lint:
- strategy:
- fail-fast: true
- matrix:
- python-version: ['3.12']
- os: [ubuntu-latest]
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-python@v4
- with:
- python-version: ${{ matrix.python-version }}
- - name: Cache dependencies
- uses: actions/cache@v3
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
- restore-keys: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-
- - name: Install Project
- run: pip install '.[test]'
- - name: Look for style errors
- run: pflake8 app
- - name: Checking for importing style
- run: isort --profile=black --check --diff app
- - name: Look for auto format errors
- run: black --check --diff app
-
- tests:
- needs: lint
- strategy:
- fail-fast: false
- matrix:
- python-version: ['3.10', '3.12']
- os: [ubuntu-latest]
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-python@v4
- with:
- python-version: ${{ matrix.python-version }}
- - name: Cache dependencies
- uses: actions/cache@v3
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
- restore-keys: |
- ${{ runner.os }}-pip-${{ matrix.python-version }}-
- - name: Install Project
- run: pip install '.[test]'
- - name: Run tests
- run: pytest -v --forked --junitxml=test-result.xml
- - name: Publish Test Results
- uses: EnricoMi/publish-unit-test-result-action@v2.16.1
- if: always()
- with:
- files: test-result.xml
- check_name: Test Result (Python ${{ matrix.python-version }})
- permissions:
- contents: read
- issues: read
- checks: write
- pull-requests: write
diff --git a/Makefile b/Makefile
index 30776e6..ba7fbcc 100644
--- a/Makefile
+++ b/Makefile
@@ -22,9 +22,6 @@ ipython:
@.venv/bin/ipython
-test:
- @.venv/bin/pytest -vv -s
-
lint:
@.venv/bin/pflake8 app kamila_project
diff --git a/app/tests.py b/app/tests.py
index d1b0f38..7ce503c 100644
--- a/app/tests.py
+++ b/app/tests.py
@@ -1,12 +1,3 @@
-import pytest
from django.test import TestCase
-from django.urls import reverse
-@pytest.mark.unit
-def test_acess_index_true(client):
- """
- Test if the index view returns a 200 status code when accessed.
- """
- url = reverse('index')
- response = client.get(url)
- assert response.status_code == 200
+# Create your tests here.
diff --git a/app/views.py b/app/views.py
index e9099eb..e6aa1cc 100644
--- a/app/views.py
+++ b/app/views.py
@@ -1,20 +1,16 @@
from django.shortcuts import render
-
from .models import Post
def base(request):
return render(request, "app/base.html")
-
def index(request):
return render(request, "app/index.html")
-
def blog(request):
posts = Post.objects.all().order_by("-created_at")
return render(request, "app/blog.html", {"posts": posts})
-
def post(request):
return render(request, "app/post.html")
diff --git a/kamila_project/settings.py b/kamila_project/settings.py
index a27e074..efcdd55 100644
--- a/kamila_project/settings.py
+++ b/kamila_project/settings.py
@@ -58,21 +58,23 @@
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",
+ '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 = "kamila_project.wsgi.application"
# Database
diff --git a/pyproject.toml b/pyproject.toml
index 2370fc1..773f4bc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,7 +8,7 @@ authors = [
{ name = "Viana Labs", email = "contacto@vianalabs.pt" }
]
dependencies = [
- "django",
+ "flask",
]
[project.optional-dependencies]
@@ -17,7 +17,6 @@ test = [
"black",
"isort",
"pytest",
- "livereload",
]
[tool.flake8]
diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644
index ef25417..0000000
--- a/pytest.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[pytest]
-DJANGO_SETTINGS_MODULE = kamila_project.settings
-python_files = tests.py test_*.py
-
-markers =
- unit: marks tests as unit tests
- integration: marks tests as integration tests
diff --git a/requirements.dev.txt b/requirements.dev.txt
index 6ebab38..3b1a852 100644
--- a/requirements.dev.txt
+++ b/requirements.dev.txt
@@ -2,13 +2,8 @@
ipython
ipdb
pudb
-pytest
pytest-watch
-# auto reload
-django-livereload
-django-livereload-server
-
# Code Quality
flake8
pyproject-flake8
diff --git a/requirements.test.txt b/requirements.test.txt
index 125b460..e69de29 100644
--- a/requirements.test.txt
+++ b/requirements.test.txt
@@ -1,2 +0,0 @@
-pytest
-pytest-django