This is a Django-based peer evaluation system.
Follow the instructions below to set up, configure, and deploy the project.
You can watch a demo of the project here:
git clone https://github.com/yourusername/peer_eval.git
cd peer_evalpython3 -m venv venv
source venv/bin/activatepip install -r requirements.txt- By default, the project uses PostgreSQL for local development.
- Edit
peer_eval/settings.py:- Update the
DATABASESsection with your local PostgreSQL credentials:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'peer_eval_db', 'USER': 'your_db_user', 'PASSWORD': 'your_db_password', 'HOST': 'localhost', 'PORT': '5432', } }
- Make sure
ALLOWED_HOSTSis set to:ALLOWED_HOSTS = ['localhost', '127.0.0.1']
- For local file storage, ensure:
MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
- Update the
python manage.py migratepython manage.py createsuperuser- Enter your own username, email, and password (your password will be private).
python manage.py runserver- Visit http://localhost:8000/admin/ and log in with your superuser credentials.
- Log in to the Django admin at
/admin/using your superuser account. - Navigate to the "Users" section.
- Click "Add user".
- Fill in the username, password, and email.
- After saving, edit the user and assign them to the "teacher" group or set the appropriate permissions/roles as needed for your app.
- Make sure you have a
render.yamlfile in your repo (already provided). - Remove any sensitive information (like secret keys) from
settings.pyand use environment variables instead.
On Render, set the following environment variables in the dashboard:
SECRET_KEY=your-production-secret-key
DEBUG=False
ALLOWED_HOSTS=your-app-name.onrender.com
DATABASE_URL=your-render-postgres-url
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret-key
AWS_STORAGE_BUCKET_NAME=your-s3-bucket-name
AWS_S3_REGION_NAME=us-east-1
- Use
django-environto read environment variables:import environ env = environ.Env() environ.Env.read_env(os.path.join(BASE_DIR, '.env')) SECRET_KEY = env('SECRET_KEY') DEBUG = env.bool('DEBUG', default=False) ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[]) DATABASES = { 'default': env.db('DATABASE_URL') } # S3 storage settings...
- Push your code to GitHub.
- Connect your repo to Render and deploy.
- On Render, run:
python manage.py migrate
- To create a superuser on Render, set these environment variables:
Then run:
DJANGO_SUPERUSER_USERNAME=youradmin DJANGO_SUPERUSER_EMAIL=your@email.com DJANGO_SUPERUSER_PASSWORD=yourpasswordRemove these variables after the superuser is created.python manage.py createsuperuser --noinput
- Never commit your
.envfile or secrets to git. - Always rotate secrets if they are accidentally exposed.
- For local testing, you can use SQLite by setting:
in your
DATABASE_URL=sqlite:///db.sqlite3.envand updatingsettings.pyto usedjango-environ.
services:
- type: web
name: peer-eval
env: python
buildCommand: pip install -r requirements.txt
startCommand: gunicorn peer_eval.wsgi:application
envVars:
- key: DJANGO_SETTINGS_MODULE
value: peer_eval.settingsIf you donβt have PostgreSQL installed, follow these steps:
- macOS:
brew install postgresql brew services start postgresql
- Ubuntu/Linux:
sudo apt update sudo apt install postgresql postgresql-contrib sudo service postgresql start
- Windows:
Download and install from https://www.postgresql.org/download/windows/
Open a terminal and enter the PostgreSQL shell:
psql postgresOr, if you get a "command not found" error, try:
sudo -u postgres psqlThen run the following commands (replace peer_eval_db, your_db_user, and your_db_password with your own values):
CREATE DATABASE peer_eval_db;
CREATE USER your_db_user WITH PASSWORD 'your_db_password';
ALTER ROLE your_db_user SET client_encoding TO 'utf8';
ALTER ROLE your_db_user SET default_transaction_isolation TO 'read committed';
ALTER ROLE your_db_user SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE peer_eval_db TO your_db_user;
\qIn peer_eval/settings.py, update the DATABASES section:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'peer_eval_db',
'USER': 'your_db_user',
'PASSWORD': 'your_db_password',
'HOST': 'localhost',
'PORT': '5432',
}
}Now you can continue with migrations and running the server as described above!
Feel free to fork and submit pull requests!
For issues, open a GitHub issue or contact the maintainer.