Update README dan gitignore
This commit is contained in:
parent
c8d06e0248
commit
169269267d
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
.pytest_cache/
|
||||||
|
.mypy_cache/
|
||||||
|
.ruff_cache/
|
||||||
|
.coverage
|
||||||
|
htmlcov/
|
||||||
|
|
||||||
|
# Virtual environment
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
|
||||||
|
# Environment/config secrets
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Local databases
|
||||||
|
*.db
|
||||||
|
*.sqlite
|
||||||
|
*.sqlite3
|
||||||
|
|
||||||
|
# IDE / OS
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
.DS_Store
|
||||||
86
README.md
86
README.md
@ -21,7 +21,31 @@ Aplikasi ini menyediakan halaman UI playground dan API endpoint untuk mengelola
|
|||||||
Pastikan sudah terinstall:
|
Pastikan sudah terinstall:
|
||||||
|
|
||||||
- Python 3
|
- Python 3
|
||||||
- pip3
|
- pip
|
||||||
|
- Git
|
||||||
|
|
||||||
|
> Catatan: Di Windows, umumnya gunakan `py` untuk menjalankan Python dan `py -m pip` untuk menjalankan pip, karena Python installer resmi Windows biasanya mendaftarkan Python melalui Python Launcher (`py`).
|
||||||
|
|
||||||
|
### Untuk Pengguna Windows
|
||||||
|
|
||||||
|
Sebelum menjalankan project, install tools berikut:
|
||||||
|
|
||||||
|
1. **Python 3**
|
||||||
|
- Download installer Python terbaru dari: https://www.python.org/downloads/windows/
|
||||||
|
- Saat instalasi, centang opsi **Add python.exe to PATH**
|
||||||
|
- Pastikan `pip` ikut terinstall bersama Python
|
||||||
|
|
||||||
|
2. **Git for Windows**
|
||||||
|
- Download dari: https://git-scm.com/download/win
|
||||||
|
- Gunakan opsi default saat instalasi
|
||||||
|
|
||||||
|
3. **Terminal**
|
||||||
|
- Bisa menggunakan **Command Prompt**, **PowerShell**, atau **Windows Terminal**
|
||||||
|
|
||||||
|
4. **Text Editor / IDE** *(opsional)*
|
||||||
|
- Visual Studio Code, PyCharm, atau editor lain sesuai preferensi
|
||||||
|
|
||||||
|
> Catatan: SQLite sudah tersedia sebagai library bawaan Python, jadi tidak perlu install SQLite secara terpisah.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -37,10 +61,18 @@ cd api-playground
|
|||||||
|
|
||||||
Disarankan menggunakan virtual environment agar dependency tidak bercampur dengan environment global.
|
Disarankan menggunakan virtual environment agar dependency tidak bercampur dengan environment global.
|
||||||
|
|
||||||
|
Di Linux/macOS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Di Windows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
py -m venv venv
|
||||||
|
```
|
||||||
|
|
||||||
### 3. Aktifkan Virtual Environment
|
### 3. Aktifkan Virtual Environment
|
||||||
|
|
||||||
Di Linux/macOS:
|
Di Linux/macOS:
|
||||||
@ -57,20 +89,36 @@ venv\Scripts\activate
|
|||||||
|
|
||||||
### 4. Install Dependencies
|
### 4. Install Dependencies
|
||||||
|
|
||||||
|
Di Linux/macOS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Di Windows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
py -m pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ▶️ Menjalankan Aplikasi
|
## ▶️ Menjalankan Aplikasi
|
||||||
|
|
||||||
Jalankan server dengan perintah:
|
Jalankan server dengan perintah:
|
||||||
|
|
||||||
|
Di Linux/macOS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python app.py
|
python app.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Di Windows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
py app.py
|
||||||
|
```
|
||||||
|
|
||||||
Server akan berjalan di:
|
Server akan berjalan di:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -83,6 +131,40 @@ atau:
|
|||||||
http://0.0.0.0:8080
|
http://0.0.0.0:8080
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Jika port `8080` sudah terpakai, gunakan opsi `--port` untuk mengganti port server.
|
||||||
|
|
||||||
|
Di Linux/macOS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python app.py --port 5000
|
||||||
|
```
|
||||||
|
|
||||||
|
Di Windows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
py app.py --port 5000
|
||||||
|
```
|
||||||
|
|
||||||
|
Server kemudian dapat diakses di:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
http://localhost:5000
|
||||||
|
```
|
||||||
|
|
||||||
|
Untuk mengganti host dan port sekaligus:
|
||||||
|
|
||||||
|
Di Linux/macOS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python app.py --host 127.0.0.1 --port 5000
|
||||||
|
```
|
||||||
|
|
||||||
|
Di Windows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
py app.py --host 127.0.0.1 --port 5000
|
||||||
|
```
|
||||||
|
|
||||||
Jika kode diubah, server akan otomatis restart karena menggunakan mode `debug=True` dan `reloader=True`.
|
Jika kode diubah, server akan otomatis restart karena menggunakan mode `debug=True` dan `reloader=True`.
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -416,7 +498,7 @@ api-playground/
|
|||||||
|
|
||||||
- Token default hanya untuk development. Untuk production, gunakan token yang lebih aman dan simpan melalui environment variable.
|
- Token default hanya untuk development. Untuk production, gunakan token yang lebih aman dan simpan melalui environment variable.
|
||||||
- Database SQLite disimpan dalam file `enroll.db`.
|
- Database SQLite disimpan dalam file `enroll.db`.
|
||||||
- Mode debug dan reloader aktif saat menjalankan `python app.py`.
|
- Mode debug dan reloader aktif saat menjalankan `python app.py` / `py app.py`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user