The following repository contains the source code of the official website of Career Development and Corporate Relations Center, IIT Ropar.
.
├── 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
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.
- Clone the repo and change the directory.
- 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.
- Change the directory into
src/
.
cd src/
- Now, run the following command to make migrations corresponding to the models in the project.
python manage.py makemigrations
- Migrate the changes into the database.
python manage.py migrate
- Now, run the development server with the following command.
python manage.py runserver
- Congrats! Now you are all set to contribute! 🎉🎉
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.
- After cloning the repo, run the following command to build the container and mount appropriate volumes.
docker-compose build
- 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.
- You may use the following command to stop the containers.
docker-compose down
Here too, with docker
, things are fairly straightforward. Before moving futher,ensure that you have put appropriate values in the .env
file.
- After cloning the repo, run the following command to build the container and mount appropriate volumes.
docker-compose -f docker-compose.prod.yml build
- 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.
- You may use the following command to stop the containers.
docker-compose -f docker-compose.prod.yml down
These are the following scripts which are used in the prod
.
Script Name | Function(s) |
startup.sh |
|
prod/main.sh |
|
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 thesass
stylesheets are insidebackend/src/static/styles
, at any point of development don't start editingcss
files insidebackend/src/static/_styles_build
- 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
andnpm
installed.
- Now install the
sass
package globally with the following command:
npm install -g sass
- Now assuming the current directory to be the
root
, run the following command.
sass -w ./backend/src/static/styles/:./backend/src/static/_styles_build
- It automatically compiles whenever you make any changes inside any of the
sass
files inbackend/src/static/styles
.
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.