Skip to content

Commit d3ab2bd

Browse files
committed
feat: melhorando o run do projeto
1 parent de7772f commit d3ab2bd

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎README.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ desenvolvimento:
122122

123123
```bash
124124
uv python install 3.14
125-
uv sync --extra dev
125+
uv sync --project source --extra dev --active
126126
```
127127

128128
### Executar a API
@@ -214,11 +214,11 @@ Caso prefira utilizar o fluxo tradicional com `pip` e `venv`, execute dentro da
214214
### Passos rapidos (Linux / macOS / Bash)
215215

216216
```bash
217-
python -m venv .venv
218-
source .venv/bin/activate
219-
python -m pip install --upgrade pip
220-
pip install -e .[dev]
221-
python src/main.py
217+
python3 -m venv source/.venv
218+
source ./source/.venv/bin/activate
219+
python3 -m pip install --upgrade pip
220+
pip install -e "./source[dev]"
221+
python3 source/src/main.py
222222
```
223223

224224
### Passo a passo detalhado
@@ -228,27 +228,27 @@ python src/main.py
228228
No Linux / macOS (Bash):
229229

230230
```bash
231-
python -m venv .venv
231+
python3 -m venv source/.venv
232232
```
233233

234234
No Windows (PowerShell):
235235

236236
```powershell
237-
py -3.14 -m venv .venv
237+
py -3.14 -m venv source/.venv
238238
```
239239

240240
#### 2. Ativar o ambiente virtual
241241

242242
No Linux / macOS (Bash):
243243

244244
```bash
245-
source .venv/bin/activate
245+
source source/.venv/bin/activate
246246
```
247247

248248
No Windows (PowerShell):
249249

250250
```powershell
251-
.\.venv\Scripts\Activate.ps1
251+
.\source\.venv\Scripts\Activate.ps1
252252
```
253253

254254
Se o PowerShell bloquear a execucao de scripts, rode uma vez:

‎source/src/main.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,9 @@ def create_app(user_service: UserService | None = None) -> FastAPI:
3939
app = create_app()
4040

4141

42+
import os
43+
4244
if __name__ == "__main__":
43-
uvicorn.run(app, host="0.0.0.0", port=8080) # nosec B104 - intentional in container
45+
host = os.getenv("UVICORN_HOST", os.getenv("HOST", "0.0.0.0"))
46+
port = int(os.getenv("UVICORN_PORT", os.getenv("PORT", "8080")))
47+
uvicorn.run(app, host=host, port=port)

0 commit comments

Comments
 (0)