Welcome to CrimePatrol, an innovative real-time crime reporting application built with the power of Django and modern web technologies. CrimePatrol is designed to empower citizens, enhance public safety, and streamline the crime reporting process. Dive into the technical intricacies of this project and learn how you can contribute to making our communities safer.
- Introduction
- Features
- Architecture
- Setup and Installation
- User Management and Access Control
- Technologies Used
- API Endpoints
- Contributing
- License
CrimePatrol is a full-stack web application that provides a platform for citizens to report crimes in real-time. Leveraging the Django framework, the app offers a robust backend for managing reports, user authentication, and geospatial data. The frontend integrates Leaflet.js for interactive maps, allowing users to visualize crime data dynamically.
- Real-Time Crime Reporting: Citizens can submit detailed crime reports with descriptions, locations, and multimedia attachments.
- Interactive Maps: View reported crimes on an interactive map with clustering for better data visualization.
- User Roles and Permissions: Distinct roles for citizens, police, and admins ensure secure and appropriate access.
- Secure Authentication: User authentication through Django's built-in system and OAuth integration.
- Media Uploads: Attach images or videos to reports to provide more context and evidence.
- Search and Filtering: Easily search and filter reports based on crime type, location, and date.
CrimePatrol is architected to ensure scalability, security, and ease of use:
- Backend: Django powers the backend, utilizing Django Rest Framework (DRF) for creating RESTful APIs and Channels for real-time features.
- Frontend: HTML, CSS, and JavaScript (with Leaflet.js) provide a responsive and interactive user interface.
- Database: PostgreSQL is used for its robustness and support for geospatial data.
- Real-Time Updates: WebSockets and Channels allow for real-time updates and notifications.
- User Authentication: Users register and log in using secure authentication methods.
- Report Submission: Citizens report crimes with detailed descriptions and geolocation data.
- Data Storage: Reports are stored in a PostgreSQL database, leveraging Django's ORM for efficient data handling.
- Map Visualization: Reports are visualized on an interactive map using Leaflet.js and marker clustering.
- Admin Management: Admins manage reports, users, and overall system settings through a secure admin interface.
Follow these steps to set up CrimePatrol on your local machine:
- Python 3.8+
- PostgreSQL
- Node.js (for frontend dependencies)
-
Clone the Repository:
git clone https://github.com/your-username/CrimePatrol.git cd CrimePatrol
-
Create and Activate Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Configure PostgreSQL:
- Create a PostgreSQL database and user.
- Update
settings.py
with your database credentials:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'CrimePatrol_db', 'USER': 'your_db_user', 'PASSWORD': 'your_db_password', 'HOST': 'localhost', 'PORT': '5432', } }
-
Run Migrations:
python manage.py makemigrations python manage.py migrate
-
Create a Superuser:
python manage.py createsuperuser
-
Run the Development Server:
python manage.py runserver
-
Access the Application: Open your browser and go to
http://localhost:8000
.
CrimePatrol incorporates a robust user management system with clear access controls:
- Roles: Users are categorized as Citizens, Police, or Admins.
- Authentication: Utilizes Django's authentication along with OAuth for social logins.
- Authorization: Implements Django's permission system to restrict access based on user roles.
- Profile Management: Users can update their profiles and manage their account settings.
- Django: High-level Python web framework.
- Django Rest Framework: Toolkit for building Web APIs.
- Django Channels: Asynchronous support for Django.
- PostgreSQL: Advanced relational database with geospatial support.
- Leaflet.js: JavaScript library for interactive maps.
- HTML/CSS/JavaScript: Core web technologies for frontend development.
CrimePatrol exposes a set of RESTful APIs for various functionalities:
- User Authentication:
/api/auth/
- Crime Reports:
/api/reports/
- User Management:
/api/users/
Refer to the API documentation for detailed endpoint information and usage.
We welcome contributions from the community! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a pull request.
CrimePatrol is licensed under the MIT License. See LICENSE
for more information.
Thank you for checking out CrimePatrol! Together, we can make our communities safer and more connected. Happy coding!