- macOS
- Homebrew installed
- Python 3.10
- Git
brew install python@3.10Verify installation:
python3.10 --versionInstall uv:
pip install uv
Assuming your project is located at:
/Users/kunal/PycharmProjects/shikshalokam-mohini-service
cd /Users/kunal/PycharmProjects/shikshalokam-mohini-serviceuv venvsource .venv/bin/activateuv syncMake sure you have a .env file in the project root.
export $(cat .env | xargs)
⚠️ Note: This exports variables only for the current shell session.
Using Homebrew:
brew install postgresql@14Start PostgreSQL:
brew services start postgresql@14Verify it’s running:
psql --versionLogin to Postgres:
psql postgresCreate a database user:
CREATE USER mitra_user WITH PASSWORD 'mitra_password';Create the database:
CREATE DATABASE mitra_db OWNER mitra_user;Grant privileges:
GRANT ALL PRIVILEGES ON DATABASE mitra_db TO mitra_user;Exit psql:
\qAdd or update the following variables in your .env file:
DATABASE_NAME=mitra_db
DATABASE_USER=mitra_user
DATABASE_PASSWORD=mitra_password
DATABASE_HOST=localhost
DATABASE_PORT=5432Make sure this dependency exists (usually already in requirements.in):
uv pip install psycopg2-binaryEnsure your virtual environment is active and env vars are loaded:
export $(cat .env | xargs)Run migrations:
python3 manage.py migrate(Optional) Create a superuser:
You can accept the default name and give any password, keep email empty and just press enter till completed.
python3 manage.py createsuperuserPostgres not starting
brew services restart postgresql@14Role does not exist
psql postgres
\duPort conflict
lsof -i :5432uvicorn shikshalokam_mohini.asgi:application \
--host 0.0.0.0 \
--port 9000 \
--workers 4 \
--ws-ping-interval 30 \
--ws-ping-timeout 300 \
--reloadOpen a new terminal (with the same virtual environment activated):
celery -A shikshalokam_mohini worker --pool=threads- Ensure Redis or any other required backing services are running before starting Celery.
- Always activate
mitra_envbefore running server or worker commands.
Perfect, let’s plug Redis setup into the README cleanly 👌 You can add this as the next section.
Redis is required for Celery and background task processing.
Using Homebrew:
brew install redisStart Redis as a background service:
brew services start redisredis-cli pingExpected output:
PONG
Redis not running
brew services restart redisPort already in use
lsof -i :6379