An interactive simulator for visualizing scenarios in special relativity. Built with a Vue 3 frontend and Django REST backend.
- Create an API client and configure the port number using an environment variable instead of hardcoding it in each request.
- Frontend: Vue.js 3, TypeScript, Vite, Vuetify, Two.js
- Backend: Django 5.2, Django REST Framework
- Package Manager: pnpm
- Python 3.10+
- Node.js (v18+ recommended)
pnpm(instead ofnpm)virtualenvorvenvfor Python
-
Navigate to the
backend/directory:cd backend -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # or use `venv\Scripts\activate` on Windows
-
Install Python dependencies:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.envfile in thebackend/directory and add:DEBUG=True SECRET_KEY=your-secret-key-here # generate your own with `python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"` ALLOWED_HOSTS=localhost,127.0.0.1 CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000 CORS_ALLOW_CREDENTIALS=True
-
Run the Django server:
python manage.py runserver
-
Navigate to the frontend directory (where
package.jsonis located):cd frontend -
Install dependencies using pnpm:
pnpm install
-
Start the development server:
pnpm dev
This will concurrently run both the Vite frontend and Django backend.