DevCom-IITB / instiapp-api

Django quasi-RESTful API for InstiApp!
https://insti.app
GNU Affero General Public License v3.0
22 stars 75 forks source link
api django django-rest-framework hacktoberfest hacktoberfest2021 iitb instiapp

InstiApp

API in Django for InstiApp, the one platform for all student activities at Indian Institute of Technology, Bombay! InstiApp's features include upcoming events, placement blog, news and general information on every active club/body in the Institute.

InstiApp Github Actions

codecov Codacy Badge Requirements Status GitHub license

Setup

To setup dependenices, install pipenv and run pipenv sync. You might want to run export PIPENV_VENV_IN_PROJECT=true first to create the virtualenv in the project folder. You can then activate the virtual environment with pipenv shell. After getting in the virtual environment run pipenv sync to install all the depencdencies in new env.

It is recommended to set up your IDE with both pylint and flake8, since these will cause the CircleCI build to fail. Google's Python Style Guide is followed upto a certain extent in all modules.

Running Tests

Tests can be run in two configurations:

Without Celery

This is the recommended and default configuration, and should suffice for all developmental purposes except if you are working with async tasks or notifications. Simply use python manage.py test --settings backend.settings_test to run automated tests.

With Celery

This is the default configuration for full-test GitHub builds. To test under this configuration, start a local PostgresQL and RabbitMQ server, and an instance of celery in background with celery -A backend worker --pool=solo -l info. Once celery is processing background tasks, you can run tests as python manage.py test --settings backend.settings_test --keepdb, ensuring that the database test_instiapp is created in postgres beforehand. The following environment variables must be set:

FTS

Full-Text Search is implemented with Sonic. To set up, install cargo and sonic and start it on localhost. Then set the USE_SONIC setting to True.

Documentation

Autogenerated OpenAPI specification can be accessed at http://server/api/docs/ (or at the official deployment)

Contributing

Pull requests are welcome, but make sure the following criteria are satisfied