This is the backend of the Pycon Tanzania Website. It is a collection of API endpoints created with the Django Rest Framework.
It has three main apps:
- Accounts - to manage user accounts
- Speakers - to manage speakers of the Pycon events
- Events - to manage events and timetables
First clone the repository:
git clone https://github.com/pycontanzania/admin pycon-admin
cd pycon-admin
Use pip to install dependencies from 'requirements.txt':
pip install -r requirements.txt
First migrate the database with:
python manage.py makemigrations accounts eventTimeTable speakers
python manage.py migrate
Create a super user account with:
python manage.py createsuperuser
Fill in the required details and run the app with:
python manage.py runserver
Access the site at: 127.0.0.1:8000
Log into the API through 127.0.0.1/login
with your username and password:
curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"your-username\", \"password\":\"your-password\"}" 127.0.0.1:8000/login/
The json response will have a key
with the Token value:
{"key":"3be93be760436e39abefc9aa4b0c7492512e55fe"}
Use this token in the Authorization Header
to access endpoints that require authorization:
curl -X POST -H "Content-Type: application/json" -H "Authorization: Token your-token" 127.0.0.1:8000/events/create/
The app consists of the following endpoints:
-
/admin - Django's default administrative portal. Requires authentication.
-
/events/ - To get a json response of all available events. Does not require authentication.
-
/events/{id} - To retrieve, update or delete individual event. Requires authentication.
-
/events/create/ - To create a new event. Requires authentication.
-
/speakers/ - To retrieve all speakers. Does not require authentication.
-
/speakers/{id} - To retrieve, edit or delete individual speaker. Requires authentication.
-
/speakers/create/ - To create a new speaker. Does not require authentication.
-
/gallery/ - To get gallery images
-
/gallery/create/ - To add gallery images
-
/gallery/{id} - To retrieve, update or delete an individual gallery image
-
/docs - To access Swagger UI documentation of the app. Does not require authentication.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.