Git Product home page Git Product logo

cdcrc_website's Introduction

Official Website of CDCRC, IIT Ropar

About

The following repository contains the source code of the official website of Career Development and Corporate Relations Center, IIT Ropar.

Directory Overview

.
├── backend
│   ├── Dockerfile 
│   ├── Dockerfile.prod
│   ├── requirements.txt
│   └── src # contains the whole backend source code
├── docker-compose.prod.yml
├── docker-compose.yml
├── _docs # documentation assets  
│   └── prod.png
├── nginx # nginx configuration to be used  
│   │        while building the production version
│   ├── Dockerfile.prod
│   └── nginx.conf
├── prod # Contains the main script which should be \
│   │        executed to clone the repo, build & start the containers
│   └── main.sh
├── README.md
└── startup.sh

Development setup without Docker

Before proceeding further, ensure that you have python3 and PostgreSQL installed on your computer! In case you don't, you can download python3 from here.

  1. Clone the repo and change the directory.
  2. Now install all dependencies.
pip install -r requirements.txt

The root directory should have a file named .env.example. Before proceeding to the next step, you must make a .env file and fill in all the values mentioned. Alternately, you may add all these values in your .bashrc script too.

Head over to compiling the stylesheets section to know how to compile the sass stylesheets.

  1. Change the directory into src/.
cd src/
  1. Now, run the following command to make migrations corresponding to the models in the project.
python manage.py makemigrations
  1. Migrate the changes into the database.
python manage.py migrate
  1. Now, run the development server with the following command.
python manage.py runserver
  1. Congrats! Now you are all set to contribute! 🎉🎉

Development setup with Docker

The development setup with docker is pretty straightforward. All you need to do is put proper values in the .env file. It will automatically make a db admin in the postgres database based on the values in the .env file.

  1. After cloning the repo, run the following command to build the container and mount appropriate volumes.
docker-compose build
  1. Now start the containers with the following command.
docker-compose up

You may use -d flag to run in detach mode.

It will start the backend server at localhost:8000.

Head over to compiling the stylesheets section to know how to compile the sass stylesheets.

  1. You may use the following command to stop the containers.
docker-compose down

Production Deployment using Docker

Here too, with docker, things are fairly straightforward. Before moving futher,ensure that you have put appropriate values in the .env file.

  1. After cloning the repo, run the following command to build the container and mount appropriate volumes.
docker-compose -f docker-compose.prod.yml build
  1. Now start the containers with the following command.
docker-compose -f docker-compose.prod.yml up

You may use -d flag to run in detach mode.

It will start the backend server at localhost:8000.

  1. You may use the following command to stop the containers.
docker-compose -f docker-compose.prod.yml down

Scripts

These are the following scripts which are used in the prod.

Script Name Function(s)
startup.sh
  • startup.sh is responsible for making migrations files corresponding to the models and then apply them to the database.
  • It also collects the static assets and pushes them into the mounted docker volume.
  • At last, it creates the superuser using the specified environment variables if there isn't any.
  • Ensure that all the containers are running before using this script.
  • Ideally, we should run this just after we run the containers. And we should run it once per deployment.
prod/main.sh
  • main.sh is responsible for checking if the COMMIT ID of the remote repo changed. If yes, it clones the repository, builds it and starts the application.
  • It calls to startup.sh in the end

Compiling the stylesheets

We recently migrated all our stylesheets to sass for ease in development. Unlike css, sass cannot be understood by the browser and thus, it needs to be compiled to css. The following steps are needed to compile the stylesheets.

⚠️ Please note that all the sass stylesheets are inside backend/src/static/styles, at any point of development don't start editing css files inside backend/src/static/_styles_build

Key Points:

  • Please note that incase of production build appropriate changes are already done in the Dockerfile.prod.
  • You need to follow the steps incase of development only
  • Before moving futher ensure that you have nodejs and npm installed.
  1. Now install the sass package globally with the following command:
npm install -g sass
  1. Now assuming the current directory to be the root, run the following command.
sass -w ./backend/src/static/styles/:./backend/src/static/_styles_build
  1. It automatically compiles whenever you make any changes inside any of the sass files in backend/src/static/styles.

Contributing

This project is open for contribution, but we would request you to kindly open issues and comment on the discussion thread before working on anything. We also expect you to write proper documentation, which will ensure that the future team doesn't face any issues.

cdcrc_website's People

Contributors

vinx-2105 avatar tarun0110 avatar subhamx avatar dhamisamreet avatar krithikagoyal avatar meritesh avatar yashvarshney02 avatar ozbridge avatar 23yashm avatar trishulya0112358 avatar dependabot[bot] avatar dhakad007 avatar

Forkers

jayeshbhojawat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.