Skip to content

This is the Backend open-source API developed to provide data to our Frontend React Website. Codedigger aims at accumulating the data of competitive programming platforms into one platform.

License

Notifications You must be signed in to change notification settings

Code-dig-ger/Backend

Repository files navigation

Codedigger Backend API

Codedigger Codedigger API Codedigger API

Contributors Forks Stargazers Issues

Apache License Contributor Covenant

LinkedIn Discord

Table of Contents

  1. Introduction
  2. Getting Started
    1. Fork, clone locally and create a branch
    2. Setting Environment First Time
      1. Basic Requirements
      2. Creating Virtual Environment
      3. Installing Requirements
      4. Setting up Database and Environment File
      5. Migrating Database
      6. Create Superuser
    3. Starting Development Server
    4. Leaving the virtual environment
    5. Update requirements file
    6. Update Database
  3. Code of Conduct
  4. Contributing
  5. License
  6. How to Get Help

Introduction

This is the backdoor REST API developed to do complex calclations, provide and store data for Codedigger Website.

Codedigger aims at accumulating the data of competitive programming platforms (Codeforces, Codechef, Atcoder, SPOJ and UVA Online Judge) into one platform. We used their publicly available APIs and introduced several unique features into our application such as friends, mentors, ladders, upsolve, problem and contest filter. This can be the ultimate stop for everyone practicing competitive programming.

User can practice topicwise list to expertise any topic, levelwise list to practice based on rating and difficulty, or can create their own list and follow that. They can filter problems based on difficulty, tag, or solved by mentor from all the sites combined at one place.

Upsolving means to solve those problems, you're not able to solve during the contest. With the help of codedigger, you will be able to upsolve codeforces, codechef, and atcoder contests in an easy and better way.

Getting Started

Fork, clone locally & create a branch

Fork Codedigger Backend repository and clone at your local

git clone https://github.com/<yourGithubUsername>/Backend.git
cd Backend/

Create a branch with a descriptive name. A good branch name would be :

git checkout -b feature/AmazingFeature
git checkout -b bugfix/user

Steps to Follow (Recommended) -

If you're working on a issue or issue is assigned to you -

  • Create a branch for issue by commenting /cib or /cib 2-3 word desc. on the issue.
  • This will create a branch with descriptive name.
  • You can push all your code related to issue in this branch.
  • When you're done, create a merge PR to master branch.
  • After review, your branch will be merged.

Setting Environment First Time

Basic Requirements

  1. Python
  2. pip

A virtual environment is a tool that helps keep dependencies required and the project isolated. If you wish to install a new library and write

pip install name_of_library

on the terminal without activating an environment, all the packages will be installed globally which is not a good practice if you’re working with different projects on your computer.

If this sounds a bit complicated, don’t worry so much because a virtual environment is just a directory that will contain all the necessary files for our project to run.

Installing venv (required once)

Windows

py -m pip install --user virtualenv
py -m venv env

Linux

python3 -m pip install --user virtualenv
python3 -m venv env

You have to start virtual environment everytime you start new terminal -

Windows

Using gitbash

. env/Scripts/activate

Using Powershell

. env\Scripts\activate

Linux

source env/bin/activate

Installing Requirements

Windows

pip install -r requirements.txt

Linux

pip3 install -r requirements.txt

Setting up Database and Environment File

Requirement- MySQL

You can download MySQL from here or download XAMPP.

Start MySQL server and create a database.

Configuring Environment Variables

cd to codedigger directory, this is our working directory. For now we will run all command in this directory only -

cd codedigger/

Make environment file in codedigger directory by copying the example file -

cp codedigger/.env.example codedigger/.env

Database Settings

DB_NAME = codedigger
DB_USER = root
DB_PASSWORD = 
DB_HOST = 127.0.0.1
DB_PORT = 3306

GMAIL Settings

You need to turn on less secure app access for sending mails.

EMAIL_HOST_USER = your_mail_id
EMAIL_HOST_PASSWORD = your_password

Migrating Database

Windows

py manage.py migrate

Linux

python3 manage.py migrate

Create Superuser

Windows

py manage.py createsupeser

Linux

python3 manage.py createsupeser

Starting Development Server

Windows

py manage.py runserver

Linux

python3 manage.py runserver

Leaving the virtual environment

deactivate

Update requirements file (Critical)

If you have installed new dependency, the pip freeze command lists the third-party packages and versions installed in the environment.

Windows

pip freeze > requirements.txt

Linux

pip3 freeze > requirements.txt

Update Database

Everytime you change db models, you need to run makemigrations and migrate to update on database.

Windows

py manage.py makemigrations
py manage.py migrate

Linux

python3 manage.py makemigrations
python3 manage.py migrate

Code of Conduct

This project and everyone participating in it is governed by the Codedigger Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Contributing

We encourage you to participate in this open source project. We love Pull Requests, Bug Reports, ideas, (security) code reviews or any other kind of positive contribution. Please review CONTRIBUTING.md for details on how to file an issue or pr.

License

Copyright 2021 Codedigger

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

How to Get Help

Email us - [email protected]

Join! our Discord Community

Back to top