Skip to content

SpartanApple/csss-site

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csss-site

1. Setup Python Environment

sudo apt-get install -y python3.7
sudo apt-get install python3-distutils --reinstall
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.7 get-pip.py --user
python3.7 -m pip install virtualenv --user
python3.7 -m virtualenv envCSSS
. envCSSS/bin/activate
git clone https://github.com/CSSS/csss-site.git
cd csss-site
python3.7 -m pip install -r requirements.txt

2. Setting the Necessary Environment Variables

want to know why the weird way of quotes are used? -> https://stackoverflow.com/a/1250279/7734535

echo 'BASE_DIR='"'"'<folder that contains csss-site repo>'"'"'' > CI/validate_and_deploy/2_deploy/site_envs
echo 'WEBSITE_SECRET_KEY='"'"'https://miniwebtool.com/django-secret-key-generator/'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
echo 'DEBUG='"'"'true'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
echo 'HOST_ADDRESS='"'"'<serverIP>'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
echo 'ENVIRONMENT='"'"'LOCALHOST'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
echo 'PORT='"'"'8000'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
echo 'DB_CONTAINER_NAME='"'"'csss_website_dev_db'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
if (you do not want to spin up a docker database){
    echo 'DB_TYPE='"'"'sqlite3'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
}else{
    echo 'DB_TYPE='"'"'postgres'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
    echo 'DB_PASSWORD='"'"'test_password'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
    echo 'DB_NAME='"'"'csss_website_db'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
    echo 'DB_PORT='"'"'5432'"'"'' >> CI/validate_and_deploy/2_deploy/site_envs
}

2.1 Set Environment Variables

cd csss-site/src
. ../../CI/validate_and_deploy/2_deploy/set_env.sh site_envs

2.2 Create log folder

mkdir -p /path/to/csss-site/website_logs/python_logs

2.3 Spin up Dockerized Database and Setup Database Entries

if (you choose to use a dockerized database){
    sudo apt-get install postgresql-contrib
    ../../CI/fixtures_and_media_download/create_dockerized_database_with_migration.sh
    git checkout <your_branch_name>
}else{
    ../../CI/fixtures_and_media_download/create_sqlite_database_with_migration.sh
}

2.4 Set up Announcement Attachments and Officer Profile Pics

if you want to download the latest email attachments and officer profile pics from the staging server
python3 manage.py setup_website --download__attachments --download__officer_images

if you want to download the latest email attachments and use the stock image for the officer profile pics
python3 manage.py setup_website --download__attachments

if you want to create decoy email attachments and download the latest officer profile pics from the staging server
python3 manage.py setup_website --download__officer_images

if you want to create decoy email attachments and use the stock image for the officer profile pics
python3 manage.py setup_website

if you want to download the latest email attachments from the staging server
python3 manage.py create_attachments  --download

if you want to create decoy email attachments
python3 manage.py create_attachments

if you want to download the latest officer profile pics from the staging server
python3 manage.py update_officer_images --download

if you want to use the stock image for the officer profile pics
python3 manage.py update_officer_images

2.5 Needed if you need to log into /admin

echo "from django.contrib.auth.models import User; User.objects.create_superuser('root', 'admin@example.com', 'root')" | python3 manage.py shell || true
> This allows you to access http://127.0.0.1:8000/admin with the credentials root/root

2.6 Run Site

python3 manage.py runserver 0.0.0.0:8000

3. Before opening a PR

Please submit PRs one week before they need to be merged.

3.1. Validating the code

../../CI/validate_and_deploy/1_validate/run_local_formatting_test.sh

Various tasks to accomplish

Link to wki for adding a webpage

Releases

No releases published

Packages

No packages published

Languages

  • Python 37.7%
  • HTML 28.2%
  • CSS 18.9%
  • JavaScript 13.1%
  • Shell 1.1%
  • Hack 1.0%