diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f14e60c --- /dev/null +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md index 058ea15..346ce73 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,31 @@ Aplikasi ini menyediakan halaman UI playground dan API endpoint untuk mengelola Pastikan sudah terinstall: - 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. +Di Linux/macOS: + ```bash python3 -m venv venv ``` +Di Windows: + +```bash +py -m venv venv +``` + ### 3. Aktifkan Virtual Environment Di Linux/macOS: @@ -57,20 +89,36 @@ venv\Scripts\activate ### 4. Install Dependencies +Di Linux/macOS: + ```bash pip install -r requirements.txt ``` +Di Windows: + +```bash +py -m pip install -r requirements.txt +``` + --- ## ▶️ Menjalankan Aplikasi Jalankan server dengan perintah: +Di Linux/macOS: + ```bash python app.py ``` +Di Windows: + +```bash +py app.py +``` + Server akan berjalan di: ```bash @@ -83,6 +131,40 @@ atau: 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`. --- @@ -416,7 +498,7 @@ api-playground/ - Token default hanya untuk development. Untuk production, gunakan token yang lebih aman dan simpan melalui environment variable. - 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`. ---