78 lines
1.5 KiB
Markdown
78 lines
1.5 KiB
Markdown
# 15 Development Setup Guide
|
|
|
|
This document outlines the local development environment and steps to get the project running.
|
|
|
|
## Prerequisites
|
|
|
|
- Python (version 3.10+)
|
|
- PostgreSQL (version 13+)
|
|
- Git
|
|
|
|
## Clone and Project Setup
|
|
|
|
````powershell
|
|
# Clone the repository
|
|
git clone https://git.allucanget.biz/allucanget/calminer.git
|
|
cd calminer
|
|
```python
|
|
|
|
## Virtual Environment
|
|
|
|
```powershell
|
|
# Create and activate a virtual environment
|
|
python -m venv .venv
|
|
.\.venv\Scripts\Activate.ps1
|
|
```python
|
|
|
|
## Install Dependencies
|
|
|
|
```powershell
|
|
pip install -r requirements.txt
|
|
```python
|
|
|
|
## Database Setup
|
|
|
|
1. Create database user:
|
|
|
|
```sql
|
|
CREATE USER calminer_user WITH PASSWORD 'your_password';
|
|
````
|
|
|
|
1. Create database:
|
|
|
|
````sql
|
|
CREATE DATABASE calminer;
|
|
```python
|
|
|
|
## Environment Variables
|
|
|
|
1. Copy `.env.example` to `.env` at project root.
|
|
1. Edit `.env` to set database connection details:
|
|
|
|
```dotenv
|
|
DATABASE_DRIVER=postgresql
|
|
DATABASE_HOST=localhost
|
|
DATABASE_PORT=5432
|
|
DATABASE_USER=calminer_user
|
|
DATABASE_PASSWORD=your_password
|
|
DATABASE_NAME=calminer
|
|
DATABASE_SCHEMA=public
|
|
````
|
|
|
|
1. The application uses `python-dotenv` to load these variables. A legacy `DATABASE_URL` value is still accepted if the granular keys are omitted.
|
|
|
|
## Running the Application
|
|
|
|
````powershell
|
|
# Start the FastAPI server
|
|
uvicorn main:app --reload
|
|
```python
|
|
|
|
## Testing
|
|
|
|
```powershell
|
|
pytest
|
|
````
|
|
|
|
E2E tests use Playwright and a session-scoped `live_server` fixture that starts the app at `http://localhost:8001` for browser-driven tests.
|