This project involves developing a web application for a travel agency using Django. The app will provide users with the ability to browse, book, and pay for various travel packages. Additionally, the application will send email confirmations, generate PDF invoices, and offer customer support through an integrated chatbot. Key features of the application include:
- User Booking & Payment: Users can browse different travel packages, view details, and book their trips through the platform. Payment integration will allow users to pay securely for their bookings.
- Email Confirmation: Upon completing a booking, the system will asynchronously send an email confirmation to the user, leveraging Celery with RabbitMQ as the message broker.
- PDF Invoice Generation: After booking, the system will generate and send a PDF invoice to the userβs email. This will be done using WeasyPrint library to dynamically generate invoices based on booking details.
- Travel News Scraping: The app will scrape travel news websites using BeautifulSoup tool to gather the latest news and tips. These articles will be stored in the appβs database for easy access by users.
- Personalized Recommendations: The system will analyze user preferences and feedback, and provide personalized recommendations for packages, activities, or destinations using libraries such as NumPy or SciPy for calculations.
This project was built using Django. You may find below the list of the frameworks/libraries that I used to build this project :
- Django (Web Framework)
- Celery (Asynchronous Task Management)
- RabbitMQ (Message Broker)
- SQLite (Database)
- BeautifulSoup (Web Scraping)
- WeasyPrint (PDF Generation)
- NumPy (Data Processing)
To get a local copy up and running follow these simple example steps.
You may find below the list of things you need to use this project :
- Python installed on your system.
- RabbitMQ installed and running.
- GTK3 installed to enable WeasyPrint to work properly (for generating PDF files).
In order to install the app you need to follow the instructions below :
- Clone the repo
git clone https://github.com/ahlem-phantom/django-travel-agency.git
- Create a virtual environement and activate it
($) python3 -m venv venv ($) .\venv\Scripts\activate.bat
- Install flask dependecies using the file "requirements.txt"
pip install -r requirements.txt
- Rename the file .env_template and fill it with your flouci api credentials with your email settings
FLOUCI_APP_TOKEN=your-app-token-here
FLOUCI_APP_SECRET=your-app-secret-here
EMAIL_HOST_USER = 'your-mail-address-here'
EMAIL_HOST_PASSWORD = 'your-mail-password-her'
DEFAULT_FROM_EMAIL = 'your-mail-address-here'
-
Run Django Migrations
python manage.py makemigrations python manage.py migrate python manage.py migrate django_celery_results
-
Create a Superuser Account for Admin Access
python manage.py createsuperuser
You'll be prompted to enter a username, email, and password for the admin account. After the superuser is created, you'll be able to log in to the Django admin dashboard.
-
Run the django server
python manage.py runserver
-
Open localhost:8000 to enjoy the app.
- Start RabbitMQ (ensure RabbitMQ is installed and running)
rabbitmq-server
- Enable RabbitMQ Management Plugin:
rabbitmq-plugins enable rabbitmq_management
This will enable the web interface at http://localhost:15672. You can log in using the default credentials (guest as both the username and password).
- Start the Celery worker
celery -A django_travel_agency worker --loglevel=info
![]() Storage of Celery Task Results in the database |
![]() RabbitMQ |
---|
- Browse Packages: Navigate to the homepage to view all available travel packages.
- Book a Trip: Select a package, provide your details, and complete the payment process.
- Receive Confirmation: Check your email for the booking confirmation and attached PDF invoice.
- Get Recommendations: Get top rated travel recommendations.
Start by exploring the available travel packages and choose the one that suits your preferences.
![]() Browse Packages |
---|
Proceed to the booking form where you can:
- Select the number of adults and children.
- Enjoy dynamic pricing: Children receive a 50% discount, and the total price updates in real-time based on your selection.
- Choose your preferred payment method: Pay online or on-site for added flexibility.
![]() Book a Trip |
---|
Once the online payment is picked, a payment URL will be generated, redirecting you to the payment page. To simulate a successful transaction, enter "111111" and you will be redirected to the success page. For a failed payment, use "0000000" to be redirected to the failure page.
![]() Flouci Payment |
![]() Booking Success |
---|
Upon Booking a pdf invoice will be generated asynchronysly and you will recieve a confirmation mail:
![]() PDF INVOICE |
![]() Booking Confirmation Email |
---|
You can also explore the latest travel news, trends, and expert tips, all conveniently gathered through web scraping.
![]() News Articles Scraping |
![]() News Articles Source: https://www.lonelyplanet.com/news |
---|
I started this but didn't have time to finish it all. I created an assistant to guide users through the booking process and gather user feedback, but time was short. I also built a recommendation system, but it's not strong enough as it relies on ratings that I personally added to the database for each travel package and user gender. It lacks user data like feedback and preferences.
![]() Chatbot Assistant |
![]() Packages Recommandations |
---|
Project Author :
![]() Ahlem Laajili |
---|
Developed with π by ahlem-phantom.