2.3 KiB
2.3 KiB
Local Development Setup (No Docker)
Backend Setup
- Create Virtual Environment (if not already done):
cd backend
python3 -m venv venv
source venv/bin/activate # On Mac/Linux
- Install Dependencies:
pip install -r requirements.txt
- Set Environment Variables:
export DATABASE_URL="sqlite:///./elmeg.db"
export SECRET_KEY="your-secret-key-for-jwt"
- Run Migrations:
alembic upgrade head
- Start Backend:
uvicorn main:app --reload --port 8000
Backend will be available at: http://localhost:8000
Frontend Setup
- Install Dependencies:
cd frontend
npm install
- Set Environment Variables:
Create
frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000
- Start Frontend:
npm run dev
Frontend will be available at: http://localhost:3000
Testing the Application
-
Create a User:
- Navigate to
http://localhost:3000 - Register a new account
- Navigate to
-
Test Features:
- Browse shows at
/archive - Search with
Cmd+K - Create a group at
/groups - Check settings at
/settings - View admin dashboard at
/admin(if superuser)
- Browse shows at
-
Create Superuser (for admin access):
# In backend directory with venv activated
python -c "
from database import engine
from models import User
from sqlmodel import Session, select
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=['bcrypt'], deprecated='auto')
with Session(engine) as session:
user = session.exec(select(User).where(User.email == 'your@email.com')).first()
if user:
user.is_superuser = True
user.role = 'admin'
session.add(user)
session.commit()
print(f'User {user.email} is now a superuser')
else:
print('User not found')
"
Common Issues
Backend won't start
- Check if port 8000 is already in use:
lsof -i :8000 - Ensure virtual environment is activated
- Verify all dependencies installed:
pip list
Frontend won't start
- Check if port 3000 is already in use:
lsof -i :3000 - Clear
.nextcache:rm -rf .next - Reinstall dependencies:
rm -rf node_modules && npm install
Database issues
- Delete and recreate:
rm elmeg.dbthenalembic upgrade head - Check migration status:
alembic current