API for the Penn Labs platform built using Django REST framework. Includes accounts engine, club directory, product listings, documentation etc.
The Labs Platform is the back-end interface to the ecosystem that facilitates the organization’s:
.env
) containing:
DATABASE_URL=mysql://USER:PASSWORD@HOST:PORT/NAME
SECRET_KEY=secret
DJANGO_SETTINGS_MODULE=Platform.settings.production
SENTRY_URL=https://pub@sentry.example.com/product
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME
docker run -d pennlabs/platform
Routes are defined in /pennlabs/urls.py
and subsequent app folders in the form of */urls.py
. Account/authorization related scripts are located in accounts/
and Penn Labs related scripts are located in org/
.
Documentation about individual endpoints is available through the documentation/
route when the Django app is running.
You will need to start both the backend and the frontend to do Platform development.
Running the backend requires Python 3.
To run the server, cd
to the folder where you cloned platform
. Then run:
cd backend
Setting up psycopg2
(this is necessary if you want to be able to modify
dependencies, you can revisit later if not)
$ apt-get install gcc python3-dev libpq-dev
Now, you can run
$ pipenv install
to install Python dependencies. This may take a few--dev
argument if you are installing locallypsycopg2
earlier, you might see$ pipenv shell
$ ./manage.py migrate
OR $ python3 manage.py migrate
$ ./manage.py populate_users
OR $ python3 manage.py populate_users
(in development,$ ./manage.py runserver
OR $ python3 manage.py runserver
Running the frontend requires Node.js and Yarn.
frontend
directory with a new terminal window. Don’t kill your backend server!yarn install
in the project directory.yarn dev
.Click Login
to log in as a test user. The ./manage.py populate_users
command creates a test user for you with username bfranklin
and password test
. Go to /api/admin
to login to this account.