-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
552 - Fix
/media
routes, also add /django-admin
and /static
rew…
…rites (#556) * cleanup: remove now-unnecessary BE_PREFIX var * route BE to test.strom.sk by default - no need for local BE. update README * `/media` route rewrite * fix `/media` links * refactor, comments * `/django-admin` and `/static` route rewrite * for superuser, add `/django-admin` to menu * fix BE /api on server * fix #551: don't prefetch media files
- Loading branch information
1 parent
c380de5
commit de828d2
Showing
23 changed files
with
161 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
# uncomment for debug server logs | ||
# DEBUG=true | ||
|
||
### BE URL | ||
# nizsie povolene vars prepisuju vyssie - zakomentuj podla potreby | ||
|
||
## developovanie proti lokalnemu BE | ||
BE_PROTOCOL=http | ||
BE_HOSTNAME=localhost | ||
BE_PORT=8000 | ||
BE_PREFIX=/api | ||
|
||
## developovanie proti BE na test.strom.sk | ||
# BE_PROTOCOL=https | ||
# BE_HOSTNAME=test.strom.sk | ||
# BE_PORT= | ||
# BE_PREFIX=/api | ||
BE_PROTOCOL=https | ||
BE_HOSTNAME=test.strom.sk | ||
BE_PORT= | ||
|
||
## developovanie proti BE na strom.sk | ||
# BE_PROTOCOL=https | ||
# BE_HOSTNAME=strom.sk | ||
# BE_PORT= | ||
# BE_PREFIX=/api | ||
# BE_PORT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,90 @@ | ||
# Návod na spustenie | ||
# webstrom-frontend | ||
|
||
- [Spustenie backendu](#spustenie-backendu) | ||
- [Lokálny BE](#lokálny-be) | ||
- [Spustenie frontendu](#spustenie-frontendu) | ||
- [CSS types (deprecated)](#css-types-deprecated) | ||
- [IDE setup](#ide-setup) | ||
|
||
## Spustenie backendu | ||
|
||
Na testovanie frontendu je potrebné mať prístup k API rozhraniu na backende. Návod na rozbehanie backendu sa nachádza vo [webstrom-backend](https://github.com/ZdruzenieSTROM/webstrom-backend/blob/master/README.md) repozitári. | ||
Defaultne sú API requesty smerované na deploynutý test BE (test.strom.sk). Zmeniť to môžeš v [.env](.env). | ||
|
||
### Lokálny BE | ||
|
||
Ak potrebuješ urobiť nejaké zmeny aj na BE (a otestovať, že to s FE funguje), musíš si spustiť BE lokálne a nasmerovať naň FE. | ||
Ak ti deployed BE stačí, pokračuj na [Spustenie frontendu](#spustenie-frontendu). | ||
|
||
Návod na rozbehanie backendu sa nachádza vo [webstrom-backend](https://github.com/ZdruzenieSTROM/webstrom-backend/blob/master/README.md) repozitári. | ||
|
||
Po inštalácii potrebných balíkov a vytvorení databázy spusti backend django server pomocou: | ||
|
||
``` | ||
```sh | ||
python manage.py runserver | ||
``` | ||
|
||
Tento príkaz spustí server na `localhost:8000`, kde sa dá pristupovať k API a k django admin stránke. | ||
|
||
Zakomentuj/odkomentuj riadky v [.env](.env), aby requesty smerovali na BE na `localhost:8000`. | ||
|
||
## Spustenie frontendu | ||
|
||
Naklonuj si projekt z GitHubu a prepni sa do priečinku projektu: | ||
|
||
``` | ||
```sh | ||
git clone https://github.com/ZdruzenieSTROM/webstrom-frontend | ||
cd webstrom-frontend | ||
``` | ||
|
||
Na nainštalovanie potrebných balíkov je potrebné mať nainštalovaný [node.js](https://nodejs.org/en/) spolu so správcom balíkov [yarn](https://classic.yarnpkg.com/en/docs/install/#windows-stable) a potrebné balíky pre projekt sa nainštalujú pomocou: | ||
Potrebuješ: | ||
|
||
``` | ||
- [Node.js](https://nodejs.org/en/) - javascriptový engine | ||
- check, či ho máš: `node -v` | ||
- dá sa nainštalovať priamo zo stránky, ale ideálne je použiť [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm) (neboj sa inštalačných inštrukcií) | ||
- [Yarn](https://yarnpkg.com/getting-started/install) - správca JS balíkov | ||
|
||
Potrebné balíky pre projekt sa nainštalujú pomocou: | ||
|
||
```sh | ||
yarn install | ||
``` | ||
|
||
alebo len | ||
|
||
``` | ||
```sh | ||
yarn | ||
``` | ||
|
||
Development server sa spustí pomocou príkazu: | ||
|
||
``` | ||
```sh | ||
yarn dev | ||
``` | ||
|
||
Tento príkaz spustí server na `localhost:3000`, ktorý reaguje na zmeny vo frontendovom kóde a automaticky sa reloaduje. | ||
|
||
## CSS types | ||
## CSS types (deprecated) | ||
|
||
Na pregenerovanie CSS typov, popisujúcich typy pre `styles` z `*.module.css` do súborov `*.module.scss.d.ts` je potrebné spustiť | ||
DEPRECATED: `.module.scss` súborov sa snažíme zbaviť. | ||
|
||
``` | ||
Na pregenerovanie CSS typov pre `styles` z `*.module.scss` (do súborov `*.module.scss.d.ts`) je potrebné spustiť: | ||
|
||
```sh | ||
yarn css-types | ||
``` | ||
|
||
Ak chceme aby sa tieto typy generovali automaticky počas vyvvíjania, je tu príkaz | ||
Ak chceme aby sa tieto typy generovali automaticky počas vyvíjania, je tu príkaz: | ||
|
||
``` | ||
```sh | ||
yarn css-types-watch | ||
``` | ||
|
||
# IDE setup | ||
## IDE setup | ||
|
||
Používame VSCode, nainštaluj si doň [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) rozšírenie. V repe máme `.vscode` config, preto sa kód pri uložení automaticky formátuje. Rozšírenie je možné doinštalovať pomocou `Ctrl+P` a spustením: | ||
Používame VSCode, nainštaluj si doň [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) rozšírenie (formátuje kód). V repe máme `.vscode` config, v ktorom zapíname "fix-on-save" - kód sa teda formátuje pri uložení súboru. | ||
|
||
``` | ||
Rozšírenie je takisto možné doinštalovať pomocou `Ctrl+P` a spustením: | ||
|
||
```sh | ||
ext install dbaeumer.vscode-eslint | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ FROM node:20 | |
ARG BE_PROTOCOL | ||
ARG BE_HOSTNAME | ||
ARG BE_PORT | ||
ARG BE_PREFIX | ||
|
||
WORKDIR /app | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ FROM node:20 | |
ARG BE_PROTOCOL | ||
ARG BE_HOSTNAME | ||
ARG BE_PORT | ||
ARG BE_PREFIX | ||
|
||
WORKDIR /app | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.