This project was developed by a group of 5 talented software engineers studying at ITI:
-
Ibrahim Saber
-
Khaled Hamdy
-
David Emad
-
Basmala Salem
- GitHub: https://github.com/basmalasalem
- LinkedIn: https://www.linkedin.com/in/basmalasalem/
-
Michael Emad
- Project Description
- Features
- Technologies
- Getting Started
- Running the Server
- API Documentation
- Testing
- Deployment
- Contributing
- License
- Contact
ITI-GP-Airbnb Backend is a robust Django-based backend system designed to power an Airbnb-like application. It offers a suite of RESTful APIs for managing user accounts, property listings, reservations, real-time chats, reviews, and more. The backend leverages Django Channels for real-time communication and integrates Cloudinary for efficient media storage.
- User Authentication and Registration: Secure user sign-up and login using Django Allauth and dj-rest-auth.
- User Profile Management: Users can view and edit their profiles, including uploading avatar images.
- Property Listings Management: CRUD operations for property listings with categorization.
- Reservations System: Manage property bookings and reservations.
- Real-time Chat Functionality: Enable real-time communication between users using WebSockets.
- Reviews and Ratings: Allow users to leave reviews and ratings for properties.
- Password Reset via Email: Secure password reset functionality with email confirmations.
- Comprehensive API Documentation: Interactive API docs using Swagger (drf-yasg).
- Media Storage: Efficient handling of media assets with Cloudinary integration.
- Security: Implemented best practices for securing user data and API endpoints.
- Backend Framework: Django 5.1.1
- API Framework: Django REST Framework
- Real-time Communication: Django Channels, Daphne 4.1.2
- Database: PostgreSQL (or as configured)
- Authentication: Django Allauth, dj-rest-auth
- Storage: Cloudinary for media assets
- API Documentation: drf-yasg (Swagger UI & ReDoc)
- Environment Management: python-decouple
- Version Control: Git, GitHub
- Other Dependencies: django-filter, channels, cloudinary_storage
Ensure you have the following installed on your system:
- Python: 3.12.x
- pip: Python package installer
- Git: Version control system
- Cloudinary Account: For media storage
- PostgreSQL: Database system (optional, depending on your database choice)
-
Clone the Repository
git clone https://github.com/your-username/ITI-GP-AIRBNB-BACKEND.git cd ITI-GP-AIRBNB-BACKEND
2.Create a Virtual Environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
3.Install Dependencies
pip install -r requirements.txt
Ensure your requirements.txt includes all necessary packages, such as Django, djangorestframework, channels, cloudinary, etc.
1.Environment Variables Create a .env file in the root directory and configure the following variables:
# .env
SECRET_KEY=your_secret_key_here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Database Configuration
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=localhost
DB_PORT=5432
# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Email Configuration
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your_email@gmail.com
EMAIL_HOST_PASSWORD=your_email_password_or_app_password
# Other configurations as needed
-- Notes:
Replace placeholder values (your_secret_key_here, your_db_name, etc.) with your actual configurations. Ensure that .env is added to your .gitignore to prevent sensitive information from being committed.
3.Apply Migrations
python manage.py createsuperuser
4.Collect Static Files
python manage.py collectstatic
Start the development server using:
python manage.py runserver
The server will start at http://127.0.0.1:8000/
Start the development server using:
python manage.py runserver
The server will start at http://127.0.0.1:8000/
API Documentation API documentation is available via Swagger UI and ReDoc:
Swagger UI:
http://127.0.0.1:8000/swagger/
ReDoc:
http://127.0.0.1:8000/redoc/
These interfaces provide interactive documentation where you can explore and test API endpoints.
Testing Run the test suite using:
python manage.py test
Ensure all tests pass to verify the integrity of the application.
For deploying the application to production, consider the following steps:
- Set
DEBUG=False
in your.env
file. - Define
ALLOWED_HOSTS
with your domain names. - Use a secure
SECRET_KEY
.
Use services like Heroku, AWS, DigitalOcean, or others.
- Use Gunicorn as the WSGI HTTP server.
- Use Nginx as a reverse proxy.
Ensure secure communication by setting up SSL certificates.
Monitor and scale resources based on the application's usage.
- Serve static files using WhiteNoise or via a CDN.
- Ensure media files are served securely, preferably via Cloudinary.
Contributions are welcome! Follow these steps to contribute:
git checkout -b feature/YourFeatureName
git commit -m "Add some feature"
git push origin feature/YourFeatureName
Open a Pull Request Describe your changes and submit the PR for review.
-
Badges:
- License Badge: Indicates the project is under the MIT License.
- Python Badge: Shows the Python version used.
- Django Badge: Displays the Django version.
- Django REST Framework & Channels Badges: Highlight additional technologies used.
-
Table of Contents:
- Provides easy navigation to different sections of the README.
-
Project Description:
- A brief overview of what the project is about.
-
Features:
- Lists the key functionalities and capabilities of the backend.
-
Technologies:
- Details the technologies and frameworks used in the project.
-
Getting Started:
- Prerequisites: Lists what is needed before setting up the project.
- Installation: Step-by-step instructions to set up the project locally.
- Configuration: Guidance on setting environment variables and other configurations.
-
Running the Server:
- Instructions on how to start the development server.
-
API Documentation:
- Links to interactive API documentation generated by Swagger and ReDoc.
-
Testing:
- Commands and instructions to run tests to ensure the application's integrity.
-
Deployment:
- High-level steps and considerations for deploying the application to a production environment.
-
Contributing:
- Guidelines for how others can contribute to the project.
-
License:
- Specifies the project's license, linking to the
LICENSE
file.
- Specifies the project's license, linking to the
-
Contact:
- Provides contact information for the project owner or maintainers.
- Repository Links: Replace
https://github.com/your-username/ITI-GP-AIRBNB-BACKEND.git
with your actual GitHub repository URL. - Cloudinary & Database Credentials: Ensure that you provide accurate details in the
.env
file and avoid committing sensitive information. - License: Ensure that you have a
LICENSE
file in your repository. If not, you can create one based on the MIT License or your preferred license. - Testing & Deployment: Expand these sections based on the specific testing frameworks and deployment strategies you employ.
- Screenshots & Media: Consider adding screenshots or media links to showcase your project visually.
-
Create the
README.md
File:In the root directory of your backend project, create a file named
README.md
and paste the above content into it. -
Adjust Placeholders:
- Replace
your-username
with your actual GitHub username. - Update the repository URL, email, and any other placeholders with your actual information.
- Ensure that all paths and configurations match your project's structure.
- Replace
-
Commit and Push:
git add README.md git commit -m "Add comprehensive README.md" git push origin main # Replace 'main' with your default branch name if different