Local Development Setup¶
Prerequisites¶
- Python 3.11+
- Git
- Redis (for Celery tasks; optional for basic Flask dev)
1. Clone the Repository¶
bash
git clone https://github.com/RohitDhongadi/Lenzeye_Deployment.git
cd Lenzeye_Deployment
2. Create Virtual Environment¶
```bash python -m venv venv
Windows¶
venv\Scripts\activate
macOS/Linux¶
source venv/bin/activate ```
3. Install Dependencies¶
bash
pip install -r requirements.txt
This installs Flask, SQLAlchemy, boto3, cryptography, Celery, psutil, and all other dependencies.
4. Set Up Environment Variables¶
Copy the shared sendgrid.env file to the project root (get this file from the founder — never commit it).
Or create it manually:
```bash
sendgrid.env¶
FLASK_ENV=development
FLASK_DEBUG=1
SECRET_KEY=
5. Initialize the Database¶
bash
flask db upgrade
This creates instance/DSS_local.db with all tables.
If you see migration errors:
bash
flask db init # only if migrations/ folder doesn't exist
flask db migrate
flask db upgrade
6. Run the Flask Dev Server¶
bash
flask run
Or:
bash
python Lenzeye.py
The app starts at http://127.0.0.1:5000.
7. (Optional) Run Celery Worker¶
Only needed if testing async S3 file listing tasks:
```bash
In a separate terminal (with venv activated)¶
celery -A celery_worker.celery_app worker --loglevel=info ```
Requires Redis running locally (redis-server).
Common Issues¶
| Issue | Fix |
|---|---|
ModuleNotFoundError: No module named 'flask' |
Activate virtual environment first |
MASTER_KEY not set |
Add MASTER_KEY=<64-hex> to sendgrid.env |
OperationalError: no such table |
Run flask db upgrade |
ConnectionRefusedError on Wasabi |
Check WASABI_ACCESS_KEY and endpoint URL |
Redis connection refused |
Start Redis: redis-server or skip Celery for basic testing |
| PowerShell venv activation error | Use venv\Scripts\Activate.ps1 or run Set-ExecutionPolicy RemoteSigned |
Generating a Test Master Key¶
python
import os
print(os.urandom(32).hex()) # Copy output to MASTER_KEY in sendgrid.env
For local development, use a different master key from production. Do not share local test keys.
TL;DR¶
Steps: Clone → venv → pip install -r requirements.txt → set up sendgrid.env → flask db upgrade → flask run. Celery optional. MASTER_KEY must be 64 hex chars.