Welcome to the Epic Events CRM project. This command-line interface (CLI) application is designed for managing clients, contracts, and events by the Management, Sales, and Support teams.
This project utilizes Python, SQLAlchemy for the ORM, PostgreSQL via Docker for the database, and Sentry for error monitoring.
Follow these steps to clone the repository, set up the virtual environment, and prepare the configuration file.
Open your terminal and use the git clone command to get a local copy of the project:
Clone the repository (replace the URL with yours)
git clone <YOUR_REPOSITORY_URL>Navigate into the project directory
cd epic-events-crmIt is crucial to use a virtual environment to isolate the project's dependencies.
python3 -m venv venvOn macOS/Linux:
source venv/bin/activateOn Windows (Command Prompt):
venv\Scripts\activate.batOn Windows (PowerShell):
venv\Scripts\Activate.ps1pip install -r requirements.txt(You should now see (venv) appear at the start of your command line, indicating the environment is active.)
The project uses an .env file to store critical environment variables (DB and Sentry).
Create a folder named database in the project root, then create an .env file inside this new folder (database/.env):
Example to create the file (Linux/macOS)
mkdir database
touch database/.envThe content of database/.env must be as follows:
--- DATABASE CONFIGURATION (PostgreSQL) --- These variables are used by SQLAlchemy in app/models.py
POSTGRES_USER=epic-events-admin
POSTGRES_PASSWORD=<StrongPostgresPassword>
POSTGRES_DB=epic_events_db
POSTGRES_ADDRESS=localhost
APP_USER=epic-events-user
APP_PASSWORD=<StrongAppPawword>
# --- SENTRY CONFIGURATION ---
# Replace <YOUR_SENTRY_DSN> with your Sentry project DSN key
SENTRY_DSN=<YOUR_SENTRY_DSN>We use Docker Compose to start an isolated instance of PostgreSQL for the database.
Ensure you have Docker and Docker Compose installed on your machine.
Make sure the docker-compose.yml file is present in the root of your project.
Start the database container:
cd database/
docker compose up -dThe PostgreSQL service is now started and accessible via localhost:5432.
The ERD has been drew on DrawDB.app: https://www.drawdb.app/editor?shareId=11b69b83c25ac27559600403c102fb4e
In case of failure charging the diagram, File > Import from > JSON and select erd.json in database/
The main.py script handles the creation of tables and the initialization of roles (Gestion, Commercial, Support) during its first run.
Run the main script
python3 main.pyDuring the first run, the system will prompt you to create a user account (the first user will be assigned the 'Gestion' role).
Use the email and password of the created user to log in. The application will automatically route you to the menu corresponding to your department.
CHANGE DEFAULT ADMIN PASSWORD
This project is instrumented with the Sentry SDK to capture unhandled errors and important logs, even in production or on remote machines.
Configuration: The SDK is initialized in main.py using the SENTRY_DSN variable read from database/.env.
Exception Capture: All fatal errors (uncaught exceptions) are automatically sent to your Sentry dashboard.
Informal Logging: For important actions that are not errors (like the creation of a new employee or the signing of a contract), informational messages are sent using sentry_sdk.capture_message(message, level='info').
To verify that Sentry is working correctly, you should:
Test an Info Log (Contract Signing): Log in, update a contract by changing its status from status_signed=False to True. An informational message should appear in your Sentry dashboard.
Test a Captured Exception: Try to trigger an unexpected error (e.g., passing an incorrect data type) to see if the error appears in Sentry.
(NOTE: These instructions are based on using the pytest framework.)
pip install pytestEnsure the PostgreSQL container is started (docker compose up -d).
Run all tests:
pytestIf you have test files in a folder named tests/, this command will execute them automatically.
