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.
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.
- 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
- Use
python manage.py collectstatic
to collect all the static files. - Change the
ALLOWED_HOSTS
insettings.py
- Set
DEBUG=False
in.env
file
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 usingpython manage.py createsuperuser
- Name your new application
- Specify the mandatory environment variables
EMAIL_HOST_USER
andEMAIL_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.
/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
- Allowed Methods:
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
- Allowed Methods:
-
/api/auth/student
- Allowed Methods:
GET
- Authorization:
Token <token>
- Fetchs information about currently logged in user
- Allowed Methods:
-
/api/auth/changepassword
- Allowed Methods:
PUT
- Required Fields:
{old_password, new_password}
- Authorization:
Token <token>
- Change the current user's password
- Allowed Methods:
-
/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)
- Allowed Methods:
-
/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
-
/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
- Allowed Methods:
-
/api/auth/add/student
- Allowed Methods:
POST
- Required Fields:
{team_token}
- Authorization:
Token <token>
- Adds the current user a member of the team
- Allowed Methods:
-
/api/auth/student/team
- Allowed Methods:
GET
- Authorization:
Token <token>
- Fetchs currently logged in user's team details
- Allowed Methods:
-
/api/team
- Allowed Methods:
GET
- Fetches all the registered teams
- Allowed Methods:
-
/api/team/{id}
- Allowed Methods:
GET
- Fetches team with the given
id
- Allowed Methods:
-
/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
- Allowed Methods:
-
/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
- Allowed Methods:
/swagger
or/redoc
- Hit these endpoints for more detailed documentation