Giter Site home page Giter Site logo

shauryaag / webathon-backend Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 108 KB

An API written in django to help conduct online hackathons/team events. It consists of user auth, team forming and project submission.

License: Apache License 2.0

Python 50.95% HTML 49.05%
online-hackathons heroku backend python django

webathon-backend's Introduction

Webathon

About

It is an API to help conduct online hackathons/team events. It consists of user auth, team forming and project submission.

Users have to register individually, and they have the option to either create a new team or join an existing team. Joining existing team worked similar to that of devfolio. After creating a new team, a token is generated and other team members can join the team using that token (max 4 members per team). Each team can submit one projects with project_name, git_link, deployment_link, description, etc.

Inspiration

The project was initially started a year ago when online hackathons was not a thing, hence it was really difficult to get any sponsorship for any online-only event. So, our only option was to create our own backend for any such thing. But ever since the pandemic, online events are the only things we are left with.

Setup locally

  • Clone the repo using git clone https://github.com/ShauryaAg/Webathon-Backend.git
  • Move into the project folder cd Webathon-Backend/
  • Create a .env file in the project folder
DEBUG = True
SECRET_KEY = '<DJANGO_SECRET>'
EMAIL_USE_SSL = False
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
DB_NAME = webathon
DB_USER = postgres
DB_PASSWORD = password
DB_HOST = localhost
DB_PORT = 5432
  • Use pip install -r requirements.txt to install all the dependency for the project.
  • Migrate the database by python manage.py migrate
  • Create Super User for the project using python manage.py createsuperuser

Production

  • Use python manage.py collectstatic to collect all the static files.
  • Change the ALLOWED_HOSTS in settings.py
  • Set DEBUG=False in .env file

Deploy on Heroku

  • Sign up on Heroku, (if you haven't already)

  • Click the "Deploy on Heroku" button below

    Deploy

Note: the newly created app has created a super-user with credentials Email: [email protected] Password: admin

You can create a new super-user after logging into the admin panel or using the Heroku CLI heroku run bash -a <your-app-name> to run bash on the newly created application. After this you can create the a new super-user using python manage.py createsuperuser

  • Name your new application
  • Specify the mandatory environment variables EMAIL_HOST_USER and EMAIL_HOST_PASSWORD to send emails.
  • Open the newly created application and go to /admin to login.
  • Set DB_HOST, DB_NAME, DB_USER, DB_PASSWORD, DB_PORT environment variables if you have a custom database.

Note: If DB_HOST environment variable is left empty, then it will use the default database provided by heroku.

Endpoint Usage

User

  • /api/auth/reg/student
    • Allowed Methods: POST
    • Required Fields: {email, college, password}
    • Other Fields: {first_name, last_name, phone_no}
    • Sends a confirmation email to the registered user

Note: User needs to confirm their email before logging in

  • /api/auth/login

    • Allowed Methods: POST
    • Required Fields: {email, password}
    • Logs in the registered user
  • /api/auth/student

    • Allowed Methods: GET
    • Authorization: Token <token>
    • Fetchs information about currently logged in user
  • /api/auth/changepassword

    • Allowed Methods: PUT
    • Required Fields: {old_password, new_password}
    • Authorization: Token <token>
    • Change the current user's password
  • /api/auth/resetpassword

    • Allowed Methods: POST
    • Required Fields: {email}
    • Sends an email with a link to reset the user's password (if registered with that email)
  • /api/auth/reg/org

    • To register an organizer who can log into Admin Panel
    • Allowed Methods: POST
    • Required Fields: {email, college, password}
    • Other Fields: {first_name, last_name, phone_no}
    • Registered organizer can log into the backend directly

Team

  • /api/auth/reg/team

    • Allowed Methods: POST
    • Required Fields: {team_name, idea}
    • Authorization: Token <token>
    • Creates a new team and adds the current user a member of the team
  • /api/auth/add/student

    • Allowed Methods: POST
    • Required Fields: {team_token}
    • Authorization: Token <token>
    • Adds the current user a member of the team
  • /api/auth/student/team

    • Allowed Methods: GET
    • Authorization: Token <token>
    • Fetchs currently logged in user's team details
  • /api/team

    • Allowed Methods: GET
    • Fetches all the registered teams
  • /api/team/{id}

    • Allowed Methods: GET
    • Fetches team with the given id

Projects

  • /api/auth/project

    • Allowed Methods: GET, POST
    • Authorization: Token <token>
    • Required Fields: {project_name, git_url}
    • Other Fields: {deploy_link, description}
    • Adds a project to the current user's team
  • /api/auth/project/{id}

    • Allowed Methods: GET, PUT, PATCH, DELETE
    • Authorization: Token <token>
    • Required Fields: {project_name, git_url}
    • Other Fields: {deploy_link, description}
    • Alter's the project with given id

Documentation

  • /swagger or /redoc
    • Hit these endpoints for more detailed documentation

webathon-backend's People

Contributors

aravindvnair99 avatar dependabot[bot] avatar kumardeepak123 avatar shauryaag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.