Skip to content

Backend Setup Guide

Setup Environment

  • Install Python >= 3.10
  • Clone this repository:
    git clone https://github.com/ehsan18t/unilink-server.git
    
  • Open project folder in terminal
    cd unilink-server
    
  • Create .venv
    python -m venv .venv
    
  • Activate venv
    .venv\Scripts\activate.bat
    
  • Install required packages
    pip install -r requirements.txt
    
  • Add .env.local file with following environment variables
    .env.local
    DJANGO_SECRET_KEY=<Django Secret Key>
    DEBUG=True
    DOMAIN=localhost:3000
    SERVER=http://localhost:8000
    SITE_NAME=UniLink
    EMAIL_HOST_USER=<Email That will be responsible for sending emails>
    EMAIL_HOST_PASSWORD=<App Password of the Email>
    AUTH_COOKIE_SECURE=False
    
    Obtain Django Secret Key Obtain Gmail App Passwords
  • Migrate database
    python manage.py makemigrations
    
    python manage.py migrate
    
  • Create admin account
    python manage.py createsuperuser
    
  • Run the server
    python manage.py runserver
    
  • Now you should be able to see the server at http://localhost:8000


Obtain Django Secret Key

Ways to Obtain Django Secret Key

  • Create a django project and copy the secret key from settings.py
  • Secret key can also be generated using following python script
    django_secret_generator.py
    from django.core.management.utils import get_random_secret_key
    get_random_secret_key()
    


Obtain Gmail App Password

You can follow the steps below to obtain the app password


Last update: August 30, 2023