A Django-based backend application for managing user access to the ALX Hub in Westlands. This system replaces manual Google Sheets sign-ins with a secure, programmatic system. Users are categorized as Students, Alumni, Staff, or Community Members, and administrators can track hub usage in real-time.
This project highlights backend development, REST API design, and role-based access control.
-
User Management (CRUD)
- Create new user profiles
- Read user details
- Update existing user information
- Delete user records
-
Role-Based Categorization
- Users categorized as Student, Alumni, Staff, or Community Member
-
Admin Panel
- Manage users via Django’s built-in admin interface
-
REST API
- Fully functional API endpoints for programmatic user management
-
Optional API Integration
- Fetch sample users/emails from external APIs for testing
- Backend: Python, Django, Django REST Framework
- Database: SQLite (upgradeable to PostgreSQL)
- API Testing: Postman
- Authentication: Django Admin (superuser login)
- Other: JSON for API payloads, RESTful architecture
-
Replacing manual sign-ins:
Created a UserProfile model with role-based access and CRUD APIs using Django REST Framework -
Validating user roles:
Added serializer validation to enforce allowed statuses:student, staff, alumni, community
│
├── alx_hub_access/ # Project settings and configuration
│ ├── __init__.py
│ ├── settings.py # Project settings
│ ├── urls.py # Root URL routes
│ └── wsgi.py
│
├── users/ # App handling user profiles
│ ├── __init__.py
│ ├── admin.py # Register models in Django admin
│ ├── apps.py
│ ├── migrations/ # Database migrations
│ ├── models.py # UserProfile model
│ ├── serializers.py # DRF serializer for UserProfile
│ ├── tests.py
│ ├── urls.py # API endpoints for CRUD
│ └── views.py # API views (CRUD logic)
│
├── db.sqlite3 # SQLite database
└── manage.py # Django management tool
-Visit: http://127.0.0.1:8000/admin/
-Log in with superuser credentials
-Manage user profiles directly from the web interface
-
Open Postman
-
Set base URL: http://127.0.0.1:8000/api/users/
-
Test all CRUD operations using JSON requests
-
Clone the repository
-
git clone https://github.com/your-username/alx-hub-access.git
- python -m venv env
- source env/bin/activate # macOS/Linux
- env\Scripts\activate # Windows
- pip install -r requirements.txt
- python manage.py migrate
- python manage.py createsuperuser
- python manage.py runserver