macOS:
- macOS
- Homebrew installed
- Python 3.10
- Git
Linux:
- Ubuntu 20.04+ (or Debian-based distro)
sudoaccess- Python 3.10
- Git
macOS:
brew install python@3.10Linux:
sudo apt update
sudo apt install -y python3.10 python3.10-venv python3.10-dev python3-pipVerify installation:
python3.10 --versionInstall uv:
pip install uv
⚠️ On Linux, ifpipdoesn't point to Python 3.10, usepython3.10 -m pip install uvinstead.
Assuming your project is located at:
macOS:
/Users/kunal/PycharmProjects/shikshalokam-mohini-service
Linux:
/home/<your-user>/projects/shikshalokam-mohini-service
macOS:
cd /Users/kunal/PycharmProjects/shikshalokam-mohini-serviceLinux:
cd /home/<your-user>/projects/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.
The app reads secrets from config/secrets.json. Create the config directory and file:
mkdir -p config
nano config/secrets.jsonPaste the content shared by your team. The file follows this structure:
{
"SECRET_KEY": "your-django-secret-key",
"DATABASE_NAME": "mitra_db",
"DATABASE_USER": "mitra_user",
"DATABASE_PASSWORD": "mitra_password",
"DATABASE_HOST": "localhost",
"DATABASE_PORT": "5432"
}ℹ️ To see all keys the app expects, run:
grep -n "SECRETS\[" shikshalokam_mohini/settings.py
macOS:
brew install postgresql@14Linux:
sudo apt install -y postgresql postgresql-contrib ffmpegmacOS:
brew services start postgresql@14Linux:
sudo systemctl start postgresql
sudo systemctl enable postgresqlVerify it's running:
macOS:
psql --versionLinux:
psql --version
sudo systemctl status postgresqlLogin to Postgres:
macOS:
psql postgresLinux:
cd /tmp && sudo -u postgres psqlℹ️ On Linux,
cd /tmpavoids a harmless "Permission denied" warning when switching to the postgres system user.
Create 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-binaryLinux only — if you get build errors, install system headers first:
sudo apt install -y libpq-dev gccThen retry the install.
Ensure 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 createsuperuserAfter migrations, run the following command to insert the required initial data into the database:
python3 manage.py prepare_dbPostgres not starting
macOS:
brew services restart postgresql@14Linux:
sudo systemctl restart postgresqlRole does not exist
macOS:
psql postgres
\duLinux:
sudo -u postgres psql
\duPort conflict
macOS:
lsof -i :5432Linux:
sudo lsof -i :5432
# or
ss -tulpn | grep 5432Peer authentication error (Linux only)
If you see FATAL: Peer authentication failed for user "mitra_user", edit pg_hba.conf:
sudo nano /etc/postgresql/14/main/pg_hba.confFind the local line and change peer to md5:
# Before
local all all peer
# After
local all all md5
Then restart:
sudo systemctl restart postgresqluvicorn 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
.venvbefore running server or worker commands.
Redis is required for Celery and background task processing.
macOS:
brew install redisLinux:
sudo apt install -y redis-servermacOS:
brew services start redisLinux:
sudo systemctl start redis
sudo systemctl enable redisredis-cli pingExpected output:
PONG
Redis not running
macOS:
brew services restart redisLinux:
sudo systemctl restart redisPort already in use
macOS:
lsof -i :6379Linux:
sudo lsof -i :6379
# or
ss -tulpn | grep 6379Once the service is up and running, set the password for the default admin account via the Django admin panel.
-
Open the admin panel in your browser: assuming the uvicorn service is running on port 9000
http://localhost:9000/admin -
Navigate to the Profiles section
-
Find the user: null@shikshalokam.org
-
Set the password to:
grit@123
⚠️ This step is required before using the service — the default account won't be accessible otherwise.
Once the admin password is configured, import company data and create a company bot.
- Download the sample CSV from Google Drive:
https://drive.google.com/file/d/1I799a5xpcgmQMPPfE7EdFI_Ot3ufiasE/view?usp=sharing
Locate the sample company/bot import template and download it locally.
- In the admin panel, navigate to the Company Bots section:
http://localhost:9000/admin/chatbot/companybot/
-
Use the Import Bot action and upload the downloaded JSON to create an company Bot.
-
Verify the bot appears in the CompanyBot list and is linked to the correct flow route before testing.
-
Once the bot is successfully imported, access it using the following URL format:
{domain}/mohini/home?flow=<flow_name>
Replace {domain} with your service domain and <flow_name> with the flow associated with the imported bot.