Skip to content

Commit

Permalink
Ajustado e-mail de confirmacao e CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
matheuspdf committed Oct 9, 2024
1 parent 714545b commit 609e41b
Show file tree
Hide file tree
Showing 11 changed files with 1,198 additions and 928 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fly.toml
.git/
*.sqlite3
.venv
26 changes: 26 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy

on:
workflow_run:
workflows:
- Integração contínua # Certifique-se que este nome está correto
types:
- completed
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
url: https://eventex.fly.dev
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Fly
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy
run: flyctl deploy --remote-only --strategy immediate
env:
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/django_ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Django CI
name: Integração contínua

on:
pull_request:
Expand All @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
Expand All @@ -33,4 +33,3 @@ jobs:
- name: Run tests
run: |
pipenv run python manage.py test
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.10-slim-bullseye
ARG PYTHON_VERSION=3.10-slim

FROM python:${PYTHON_VERSION}

Expand All @@ -20,9 +20,9 @@ COPY Pipfile Pipfile.lock /code/
RUN pipenv install --deploy --system
COPY . /code

ENV SECRET_KEY "yUmJW4nXzm3ecLpS4S7Dc7jPaje16aWMrOo1UxMJGcLsbkC00o"
# RUN python manage.py collectstatic --noinput
ENV SECRET_KEY "z2qrNgGtnBQCvgW8e8jcs9AiDBIAEaLE3DtC5WCfT47ztXkVUB"
RUN python manage.py collectstatic --noinput

EXPOSE 8000

CMD ["gunicorn", "--bind", ":8000", "--workers", "2", "eventex.wsgi"]
CMD ["gunicorn","--bind",":8000","--workers","2","eventex.wsgi"]
4 changes: 1 addition & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ gunicorn = "*"
psycopg2-binary = "*"
ipython = "*"
notebook = "==6.5.5"
django-extensions = "*"
traitlets = "==5.9.0"
django-test-without-migrations = "*"
sqlformatter = "*"
jupyterlab-pygments = "*"
django-extensions = "*"

[dev-packages]
flake8 = "*"
Expand Down
2,059 changes: 1,152 additions & 907 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions eventex/core/tests/test_model_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def setUp(self):
def test_email(self):
qs = Contact.objects.emails()
expected = ['[email protected]']
self.assertQuerysetEqual(qs, expected, lambda o: o.value)
self.assertListEqual(list(qs.values_list('value', flat=True)), expected)

def test_phones(self):
qs = Contact.objects.phones()
expected = ['21-996186180']
self.assertQuerysetEqual(qs, expected, lambda o: o.value)
self.assertListEqual(list(qs.values_list('value', flat=True)), expected)
4 changes: 2 additions & 2 deletions eventex/core/tests/test_model_talk.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def test_manager(self):
def test_at_morning(self):
qs = Talk.objects.at_morning()
expected = ['Morning Talk']
self.assertQuerysetEqual(qs, expected, lambda o: o.title)
self.assertListEqual(list(qs.values_list('title', flat=True)), expected)

def test_at_afternoon(self):
qs = Talk.objects.at_afternoon()
expected = ['Afternoon Talk']
self.assertQuerysetEqual(qs, expected, lambda o: o.title)
self.assertListEqual(list(qs.values_list('title', flat=True)), expected)


class CourseModelTest(TestCase):
Expand Down
4 changes: 2 additions & 2 deletions eventex/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/
"""

# from email.policy import default
from pathlib import Path
from decouple import config, Csv
from dj_database_url import parse as dburl
Expand Down Expand Up @@ -139,5 +139,5 @@
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
DEFAULT_FROM_EMAIL = config("DEFAULT_FROM_EMAIL")

CSRF_TRUSTED_ORIGINS = ["https://wttd.fly.dev/"]
CSRF_TRUSTED_ORIGINS = ["https://eventex.fly.dev/"]
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
2 changes: 1 addition & 1 deletion eventex/subscriptions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create(request):
_send_email('Confirmação de inscrição',
settings.DEFAULT_FROM_EMAIL,
subscription.email,
'subscriptions/subscription_detail.html',
'subscriptions/subscription_email.txt',
{'subscription': subscription})

return HttpResponseRedirect(r('subscriptions:detail', subscription.pk))
Expand Down
9 changes: 5 additions & 4 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# fly.toml app configuration file generated for wttd on 2024-02-06T21:42:37-03:00
# fly.toml app configuration file generated for eventex on 2024-10-08T19:51:08-03:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'wttd'
app = 'eventex'
primary_region = 'gru'
console_command = '/code/manage.py shell'

Expand All @@ -15,10 +15,11 @@ console_command = '/code/manage.py shell'
[env]
PORT = '8000'


[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']
Expand All @@ -29,5 +30,5 @@ console_command = '/code/manage.py shell'
memory_mb = 1024

[[statics]]
guest_path = '/code/staticfiles'
guest_path = '/code/static'
url_prefix = '/static/'

0 comments on commit 609e41b

Please sign in to comment.