nordabiz/docs/REFACTORING_STATUS.md
Maciej Pienczyn b89ff11c36 docs: Add refactoring status and deployment plan
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 10:11:25 +01:00

3.5 KiB

Status Refaktoringu app.py

Ostatnia aktualizacja: 2026-01-27 Autor sesji: Claude Opus 4.5

Stan obecny

Faza 1 - UKOŃCZONA (na DEV)

Commit: 66856a6 (lokalny, NIE WDROŻONY na PROD)

Blueprint URL Prefix Routes Status
reports /raporty 4 Przetestowane
contacts /kontakty 6 Przetestowane
classifieds /tablica 4 Przetestowane
calendar /kalendarz 3 Przetestowane

Nowa struktura plików:

nordabiz/
├── blueprints/
│   ├── __init__.py          # register_blueprints()
│   ├── reports/
│   │   ├── __init__.py
│   │   └── routes.py
│   └── community/
│       ├── __init__.py
│       ├── contacts/
│       ├── classifieds/
│       └── calendar/
├── utils/
│   ├── decorators.py        # admin_required, etc.
│   ├── helpers.py           # sanitize_input, etc.
│   ├── notifications.py
│   ├── analytics.py
│   ├── middleware.py
│   ├── context_processors.py
│   └── error_handlers.py
├── extensions.py            # csrf, login_manager, limiter
└── config.py               # Dev/Prod configurations

Redukcja app.py: ~14,455 → ~13,699 linii (~5.2%)


Harmonogram

⚠️ BLOKADA WDROŻEŃ

Do czwartku 30.01.2026 godz. 19:00 - NIE WDRAŻAĆ NA PRODUKCJĘ!

Powód: Prezentacja portalu dla członków Norda Biznes.

Plan po prezentacji

Data Zadanie
31.01 (pt) Wdrożenie Fazy 1 na PROD
Luty Faza 2: public + auth (~25 routes)
Luty-Marzec Fazy 3-7: API, chat, admin, audits, ZOPK

Procedura wdrożenia Fazy 1

# 1. Push do repozytoriów
git push origin master && git push inpi master

# 2. Deploy na PROD
ssh maciejpi@10.22.68.249 "cd /var/www/nordabiznes && sudo -u www-data git pull && sudo systemctl restart nordabiznes"

# 3. Weryfikacja
curl -sI https://nordabiznes.pl/health
curl -sI https://nordabiznes.pl/raporty/
curl -sI https://nordabiznes.pl/kontakty/
curl -sI https://nordabiznes.pl/tablica/
curl -sI https://nordabiznes.pl/kalendarz/

Naprawione błędy podczas testów DEV

Plik Problem Rozwiązanie
blueprints/reports/routes.py url_for('report_*') url_for('.report_*')
templates/contacts/detail.html contact_delete contacts.contact_delete
templates/contacts/list.html contacts_list (3x) contacts.contacts_list
templates/classifieds/index.html classifieds_index (6x) classifieds.classifieds_index
templates/classifieds/view.html classifieds_close, classifieds_index Dodano prefix classifieds.
templates/calendar/event.html calendar_rsvp calendar.calendar_rsvp

Lekcje na przyszłość

  1. url_for w blueprintach:

    • Wewnątrz blueprintu: url_for('.endpoint') (z kropką)
    • W szablonach: url_for('blueprint.endpoint') (pełna nazwa)
  2. Testowanie po migracji:

    • Sprawdź WSZYSTKIE szablony używające url_for()
    • Użyj grep: grep -r "url_for\(" templates/
  3. Restart serwera:

    • Flask cachuje szablony - wymaga pełnego restartu
    • Zabij proces i uruchom od nowa

Kontakt

W razie problemów z wdrożeniem sprawdź:

  • Logi: /var/log/nordabiznes/
  • Health check: curl https://nordabiznes.pl/health
  • Rollback: git revert HEAD && git push