Django Hotel Management System With Source Code

Django Hotel Management System With Source Code

A Django Hotel Reservation System Project in Django contains different features like, Login and Signup functionality for both manager and customer users, Customers can book room based on availability and See the booking history and edit order from the dashboard.

This Hotel Management System In Django also includes a downloadable Project With Source Code for free, just find the downloadable source code below and click to start downloading.

To start creating a Django Hotel Management System, makes sure that you have PyCharm Professional IDE or any platform of django and its requirements Installed in your computer.

About ProjectProject DetailsDefinition
Project Name Hotel Management System Project in DjangoThe Django Hotel Management System is developed using Python DjangoHTML,CSS and JavaScript, This Hotel Booking App In Django is fully responsive website(for both mobile and larger screens) based on google material design. Also this project has Custom dashboard for both Customer and Room Manager.
Python version (Recommended)3.8 VersionPython 3.8 introduces some new syntax to the language, as well as a few small modifications to existing behavior and, most importantly, a slew of performance improvements, following in the footsteps of the previous 3.7 version.
Programming Language UsedPython Django LanguageDjango is a high-level Python web framework for building safe and maintainable websites quickly. Django is a web framework built by experienced developers that takes care of a lot of the heavy lifting so you can focus on developing your app instead of reinventing the wheel.
Developer Name itsourcecode.comFree projects containing source code in Java, PHP, Python, Django, VB.Net, Visual Basic, C, C++, C#, Javascript, and other languages are available on this website.
IDE Tool (Recommended)Sublime, Visual Studio, PyCharmSublime Text is a source code editor that is available for purchase. It comes with built-in support for a variety of programming and markup languages. Plugins, which are often community-built and maintained under free-software licenses, allow users to extend the functionality of the system. Sublime Text has a Python API to help with plugins.
Project Type Web ApplicationA web application, unlike computer-based software programs that operate locally on the device’s operating system, is application software that runs on a web server. The user uses a web browser with an active network connection to access web apps.
DatabaseSQLiteSQLite is a programming language that is used to create embedded software for devices such as televisions, cell phones, and cameras. It can handle HTTP requests with low to medium traffic. SQLite has the ability to compress files into smaller bundles with less metadata. SQLite is a temporary dataset that is used within an application to process data.
Blood Bank Management System Project in Django Overview

Reminders

To perform this python django project make sure that you have knowledge in the following:

  • CSS
  • HTML
  • Javascript
  • Database Management

Features Of This Django Hotel Management System

  • Fully responsive website(for both mobile and larger screens) based on google material design.
  • Login/Signup/Logout feature for both Customer and Room Manager.
  • Custom dashboard for both Customer and Room Manager.
  • Facility to add, delete, update rooms by Room Manager.
  • Room Manager can see the details of user that has booked one of his rooms.
  • Customer can cancel the room booking.
  • Contact form support for every visitor of website.
  • Superuser have access to all the functionality listed above.

In This Django Hotel Management System Consist Of The Following Method:

  • booking – In this method which is the booking transaction of the system.
  • customer – In this method which is the customer side.
  • login – In this method which is the Login of the system for both customer and room manager.
  • media – In this method which you can found all the media that being uploaded to the system.
  • room_manager – In this method which is the manager side.
  • room_slot – In this method which is the main method of the system.
  • template – In this method which is the template design of the system.

Steps on how to create a Django Hotel Management System With Source Code

Django Hotel Management System With Source Code

Hotel Management System Project In ...
Hotel Management System Project In Python With Source Code | 2021 FREE Download
  • Step 1: Open file.

    First , open “pycharm professional” after that click “file” and click “new project“.
    hotel management system open file

  • Step 2: Choose Django.

    Second, after click “new project“, choose “Django” and click.
    hotel management system create django

  • Step 3: Select file location.

    Third, select a file location wherever you want.
    hotel management system file location

  • Step 4: Create application name.

    Fourth, name your application.
    hotel management system application name

  • Step 5: Click create.

    Fifth, finish creating project by clicking “create” button.
    hotel management system create project

  • Step 6: Start of coding.

    you are free to copy the following codes below in the given modules and method required.

The List Of Module Given Below Are Under The “Booking” Method

  • The Code Given Below Is For The “views.py” Module – you can add the following code below into your “views.py” under the “Booking” method.
from django.shortcuts import render,redirect
from .models import Contact
from .models import Rooms,Booking
from login.models import Customer
from django.contrib import messages
from django.http import HttpResponse
import datetime
def index(request):
    return render(request,'booking/index.html',{})
def contact(request):
    if request.method=="GET":
     return render(request,"contact/contact.html",{})
    else:
     username=request.POST['name']
     email=request.POST['email']
     message=request.POST['message']
     data=Contact(name=username,email=email,message=message)
     data.save()
     return render(request,"contact/contact.html",{'message':'Thank you for contacting us.'})
def book(request):
    if request.method=="POST":
        start_date=request.POST['start_date']
        end_date=request.POST['end_date']
        request.session['start_date']=start_date
        request.session['end_date']=end_date
        start_date=datetime.datetime.strptime(start_date, "%d/%b/%Y").date()
        end_date=datetime.datetime.strptime(end_date, "%d/%b/%Y").date()
        no_of_days=(end_date-start_date).days
        data=Rooms.objects.filter(is_available=True,no_of_days_advance__gte=no_of_days,start_date__lte=start_date)
        request.session['no_of_days']=no_of_days
        return render(request,'booking/book.html',{'data':data})
    else:
        return redirect('index')
def book_now(request,id):
    if request.session.get("username",None) and request.session.get("type",None)=='customer':
        if request.session.get("no_of_days",1):
            no_of_days=request.session['no_of_days']
            start_date=request.session['start_date']
            end_date=request.session['end_date']
            request.session['room_no']=id
            data=Rooms.objects.get(room_no=id)
            bill=data.price*int(no_of_days)
            request.session['bill']=bill
            roomManager=data.manager.username
            return render(request,"booking/book-now.html",{"no_of_days":no_of_days,"room_no":id,"data":data,"bill":bill,"roomManager":roomManager,"start":start_date,"end":end_date})
        else:
            return redirect("index")
    else:
        next="book-now/"+id
        return redirect('user_login')
def book_confirm(request):
    room_no=request.session['room_no']
    start_date=request.session['start_date']
    end_date=request.session['end_date']
    username=request.session['username']
    user_id=Customer.objects.get(username=username)
    room=Rooms.objects.get(room_no=room_no)
    amount=request.session['bill']
    start_date=datetime.datetime.strptime(start_date, "%d/%b/%Y").date()
    end_date=datetime.datetime.strptime(end_date, "%d/%b/%Y").date()
    data=Booking(room_no=room,start_day=start_date,end_day=end_date,amount=amount,user_id=user_id)
    data.save()
    room.is_available=False
    room.save()
    del request.session['start_date']
    del request.session['end_date']
    del request.session['bill']
    del request.session['room_no']
    messages.info(request,"Room has been successfully booked")
    return redirect('user_dashboard')
def cancel_room(request,id):
    data=Booking.objects.get(id=id)
    room=data.room_no
    room.is_available=True
    room.save()
    data.delete()
    return HttpResponse("Booking Cancelled Successfully")
def delete_room(request,id):
    data=Rooms.objects.get(id=id)
    manager=data.manager.username
    if manager==request.session['username']:
        data.delete()
        return HttpResponse("You have deleted the room successfully")
    else:
        return HttpResponse("Invalid Request")


            



    

In this module which is the index module of the Booking method.

  • The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “Booking” method.
from django.urls import path
from . import views
urlpatterns=[
    path('',views.index,name='index'),
    path('book',views.book,name='book'),
    path('contact-us',views.contact,name='contact-us'),
    path('book-now/<str:id>',views.book_now,name='book-now'),
    path('cancel-room/<str:id>',views.cancel_room,name='cancel-room'),
    path('delete-room/<str:id>',views.delete_room,name='delete-room'),
    path('confirm-now-booking',views.book_confirm,name="book_confirm")

]

In this module which is the URL configuration module under Booking method.

The Code Given Below Is For The “models.py” Module – you can add the following code below into your “models.py” under the “Booking” method.

from django.db import models
from login.models import Customer,RoomManager
from datetime import date
class Contact(models.Model):
    name=models.CharField(max_length=100)
    email=models.CharField(max_length=100)
    message=models.TextField(max_length=2000)
    def __str__(self):
        return self.name
class Rooms(models.Model):
    manager=models.ForeignKey(RoomManager, on_delete=models.CASCADE)
    room_no=models.CharField(max_length=5)
    room_type=models.CharField(max_length=50)
    is_available=models.BooleanField(default=True)
    price=models.FloatField(default=1000.00)
    no_of_days_advance=models.IntegerField()
    start_date=models.DateField(auto_now=False, auto_now_add=False)
    room_image=models.ImageField(upload_to="media", height_field=None, width_field=None, max_length=None,default='0.jpeg')
    def __str__(self):
        return "Room No: "+str(self.id)
'''
class RoomImage(models.Model):
    room=models.ForeignKey(Rooms, on_delete=models.CASCADE)
    room_image=models.ImageField(upload_to="media", height_field=None, width_field=None, max_length=None)
'''
class Booking(models.Model):
    room_no=models.ForeignKey(Rooms, on_delete=models.CASCADE)
    user_id=models.ForeignKey(Customer, on_delete=models.CASCADE)
    start_day=models.DateField(auto_now=False, auto_now_add=False)
    end_day=models.DateField(auto_now=False, auto_now_add=False)
    amount=models.FloatField()
    booked_on=models.DateTimeField(auto_now=True, auto_now_add=False)
    def __str__(self):
        return "Booking ID: "+str(self.id)
    @property
    def is_past_due(self):
        return date.today()>self.end_day


In this module which you can found classes to be call under Booking method.

The List Of Module Given Below Are Under The “Customer” Method

  • The Code Given Below Is For The “views.py” Module – you can add the following code below into your “views.py” under the “Customer” method.
from django.shortcuts import render,redirect
from login.models import Customer
from booking.models import Booking
import datetime
def dashboard(request):
  if request.session.get('username',None) and request.session.get('type',None)=='manager':
        return redirect('manager_dashboard')
  if request.session.get('username',None) and request.session.get('type',None)=='customer':
      username=request.session['username']
      data=Customer.objects.get(username=username)
      booking_data=Booking.objects.filter(user_id=data).order_by('-id')
      counts=booking_data.filter(end_day__lt=datetime.datetime.now()).count()
      available=len(booking_data)-counts
      return render(request,"user_dash/index.html",{"data":booking_data,"count":counts,"available":available})
  else:
      return redirect("user_login")
def details(request,id,booking_id):
    if not request.session.get('username',None):
      return redirect('manager_login')
    if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
    try:
        booking_data=Booking.objects.get(id=booking_id)
        user=Customer.objects.get(id=id)
        return render(request,"user_dash/details.html",{"user":user,"booking_data":booking_data})
    except:
        return redirect("/manager/dashboard1/")

In this module which is the index module of the Customer method.

  • The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “Customer” method.
from django.urls import path
from . import views
urlpatterns=[
    path('',views.dashboard,name='user_dashboard'),
    path('details/<int:id>/<int:booking_id>',views.details,name='user_details')
]

In this module which is the URL configuration module under Customer method.

The List Of Module Given Below Are Under The “Login” Method

  • The Code Given Below Is For The “views.py” Module – you can add the following code below into your “views.py” under the “Login” method.
from django.shortcuts import render,redirect
from .models import Customer,RoomManager
from django.contrib.auth.hashers import make_password,check_password
from django.contrib import messages
#mesages.info(request,'mail taken')
def user_login(request):
    if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
    if request.session.get('username',None) and request.session.get('type',None)=='manager':
        return redirect('manager_dashboard')
    if request.method=="POST":
        username=request.POST['username']
        password=request.POST['password']
        if not len(username):
            messages.warning(request,"Username field is empty")
            redirect('user_login')
        elif not len(password):
            messages.warning(request,"Password field is empty")
            redirect('user_login')
        else:
            pass
        if Customer.objects.filter(username=username):
            user=Customer.objects.filter(username=username)[0]
            password_hash=user.password
            res=check_password(password,password_hash)
            if res==1:
                request.session['username'] = username
                request.session['type'] = 'customer'
                return render(request,'booking/index.html',{})
            else:
                messages.warning(request,"Username or password is incorrect")
                redirect('user_login')
        else:
            messages.warning(request,"No, Account exist for the given Username")
            redirect('user_login')
    else:
        redirect('user_login')
    return render(request,'login/user_login.html',{})
def manager_login(request):
    if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
    if request.session.get('username',None) and request.session.get('type',None)=='manager':
        return redirect('manager_dashboard')
    if request.method=="POST":
        username=request.POST['username']
        password=request.POST['password']
        if not len(username):
            messages.warning(request,"Username field is empty")
            redirect('manager_login')
        elif not len(password):
            messages.warning(request,"Password field is empty")
            redirect('manager_login')
        else:
            pass
        if RoomManager.objects.filter(username=username):
            user=RoomManager.objects.filter(username=username)[0]
            password_hash=user.password
            res=check_password(password,password_hash)
            if res==1:
                request.session['username'] = username
                request.session['type'] = 'manager'
                return render(request,'booking/index.html',{})
            else:
                messages.warning(request,"Username or password is incorrect")
                redirect('manager_login')
        else:
            messages.warning(request,"No, Account exist for the given Username")
            redirect('manager_login')
    else:
        redirect('manager_login')
    return render(request,'login/manager_login.html',{})
def user_signup(request):
    if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
    if request.session.get('username',None) and request.session.get('type',None)=='manager':
        return redirect('manager_dashboard')
    if request.method=="POST":
        username=request.POST['username']
        email=request.POST['email']
        if Customer.objects.filter(username=username) or Customer.objects.filter(email=email):
           messages.warning(request,"Account already exist, please Login to continue")
        else:
            password=request.POST['password']
            address=request.POST['address']
            pin_code=request.POST['pin_code']
            profile_pic=request.FILES.get('profile_pic',None)
            phone_no=request.POST['phone_no']
            state=request.POST['state']
            error=[]
            if(len(username)<3):
                error.append(1)
                messages.warning(request,"Username Field must be greater than 3 character.")
            if(len(password)<5):
                error.append(1)
                messages.warning(request,"Password Field must be greater than 5 character.")
            if(len(email)==0):
                error.append(1)
                messages.warning(request,"Email field can't be empty")
            if(len(phone_no)!=10):
                error.append(1)
                messages.warning(request,"Valid Phone number is a 10 digit-integer.")
            if(len(error)==0):
                password_hash = make_password(password)
                customer=Customer(username=username,password=password_hash,email=email,phone_no=phone_no,address=address,state=state,pin_code=pin_code,profile_pic=profile_pic)
                customer.save()
                messages.info(request,"Account Created Successfully, please Login to continue")
                redirect('user_signup')
            else:
                redirect('user_signup')
        
    else:
        redirect('user_signup')
    return render(request,'login/user_login.html',{})
def manager_signup(request):
    if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
    if request.session.get('username',None) and request.session.get('type',None)=='manager':
        return redirect('manager_dashboard')
    if request.method=="POST":
        username=request.POST['username']
        email=request.POST['email']
        if RoomManager.objects.filter(username=username) or RoomManager.objects.filter(email=email):
           messages.warning(request,"Account already exist, please Login to continue")
        else:
            password=request.POST['password']
            profile_pic=request.FILES.get('profile_pic',None)
            phone_no=request.POST['phone_no']
            error=[]
            if(len(username)<3):
                error.append(1)
                messages.warning(request,"Username Field must be greater than 3 character.")
            if(len(password)<5):
                error.append(1)
                messages.warning(request,"Password Field must be greater than 5 character.")
            if(len(email)==0):
                error.append(1)
                messages.warning(request,"Email field can't be empty")
            if(len(phone_no)!=10):
                error.append(1)
                messages.warning(request,"Valid Phone number is a 10 digit-integer.")
            if(len(error)==0):
                password_hash = make_password(password)
                r_manager=RoomManager(username=username,password=password_hash,email=email,phone_no=phone_no,profile_pic=profile_pic)
                r_manager.save()
                messages.info(request,"Account Created Successfully, Please login to continue")
                redirect('manager_signup')
            else:
                redirect('manager_signup')
        
    else:
        redirect('user_signup')
    return render(request,'login/manager_login.html',{})
def logout(request):
    if request.session.get('username', None):
        del request.session['username']
        del request.session['type']
        return render(request,"login/logout.html",{})
    else:
        return render(request,"login/user_login.html",{})


In this module which is the index module of the Login method.

  • The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “Login” method.
from django.urls import path,include
from . import views
urlpatterns=[
    path('login',views.user_login,name='user_login'),
    path('login1',views.manager_login,name='manager_login'),
    path('signup',views.user_signup,name='user_signup'),
    path('signup1',views.manager_signup,name='manager_signup'),
    path('dashboard/',include('customer.urls')),
    path('dashboard1/',include('room_manager.urls')),
    path('add-room/',include('room_manager.urls'))
]

In this module which is the URL configuration module under Login method.

  • The Code Given Below Is For The “models.py” Module – you can add the following code below into your “models.py” under the “Login” method.
from django.db import models
from PIL import Image
class Customer(models.Model):
    username=models.CharField(max_length=100)
    password=models.CharField(max_length=100)
    email=models.CharField(max_length=50)
    profile_pic=models.ImageField(upload_to="media", height_field=None, width_field=None, max_length=None,blank=True)
    phone_no=models.CharField(max_length=50)
    address=models.TextField()
    state=models.CharField(max_length=30,blank=True)
    pin_code=models.IntegerField(blank=True)
    def __str__(self):
        return "Customer: "+self.username
class RoomManager(models.Model):
    username=models.CharField(max_length=100)
    password=models.CharField(max_length=100)
    email=models.CharField(max_length=50)
    profile_pic=models.ImageField(upload_to="media", height_field=None, width_field=None, max_length=None,blank=True)
    phone_no=models.CharField(max_length=50)
    gender=models.CharField(max_length=20)
    def __str__(self):
        return "Room Manager: "+self.username

In this module which you can found classes to be call under Login method.

The List Of Module Given Below Are Under The “Room Manager” Method

  • The Code Given Below Is For The “views.py” Module – you can add the following code below into your “views.py” under the “Room Manager” method.
from django.shortcuts import render,redirect
from login.models import RoomManager
from booking.models import Booking,Rooms
from datetime import date
from django.contrib import messages
import datetime
def dashboard(request):
  if not request.session.get('username',None):
      return redirect('manager_login')
  if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
  if request.session.get('username',None) and request.session.get('type',None)=='manager':
      username=request.session['username']
      data=RoomManager.objects.get(username=username)
      room_data=data.rooms_set.all()
      booked=room_data.filter(is_available=False).count()
      print(booked)
      return render(request,"manager_dash/index.html",{"room_data":room_data,"manager":data,"booked":booked})
  else:
      return redirect("manager_login")
def add_room(request):
    if not request.session.get('username',None):
      return redirect('manager_login')
    if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
    if request.method=="GET":
        return render(request,"manager_dash/add-room.html",{})
    else:
            room_no=request.POST['room_no']
            room_type=request.POST['room_type']
            price=request.POST['price']
            room_image=request.FILES.get('room_image',None)
            no_of_days_advance=request.POST['no_of_days_advance']
            start_day=request.POST['start_day']
            error=[]
            if(len(room_no)<1):
                error.append(1)
                messages.warning(request,"Room No Field must be atleast 3 digit like 100.")
            if(len(room_type)<5):
                error.append(1)
                messages.warning(request,"Select a valid Room Type.")
            if(len(price)<=2):
                error.append(1)
                messages.warning(request,"Please enter price")
            if(len(no_of_days_advance)<1):
                error.append(1)
                messages.warning(request,"Please add valid no of days a user can book room in advance.")
            if(len(start_day)<3):
                error.append(1)
                messages.warning(request,"Please add the starting day")
            if(not len(error)):
                manager=request.session['username']
                manager=RoomManager.objects.get(username=manager)
                room=Rooms(room_no=room_no,room_type=room_type,price=price,no_of_days_advance=no_of_days_advance,start_date=datetime.datetime.strptime(start_day, "%d %B, %Y").date(),room_image=room_image,manager=manager)
                room.save()
                messages.info(request,"Room Added Successfully")
                return redirect('/manager/dashboard1/')
            else:
                return redirect('/user/add-room/new/')
def update_room(request,room_no):
    if not request.session.get('username',None):
      return redirect('manager_login')
    if request.session.get('username',None) and request.session.get('type',None)=='customer':
        return redirect('user_dashboard')
    room=Rooms.objects.get(room_no=room_no)
    if request.method=="GET":
        return render(request,"manager_dash/edit-room.html",{"room":room})
    else:
            price=request.POST['price']
            no_of_days_advance=request.POST['no_of_days_advance']
            error=[]
            if(len(price)<=2):
                error.append(1)
                messages.warning(request,"Please enter correct price")
            if(len(no_of_days_advance)<1):
                error.append(1)
                messages.warning(request,"Please add valid no of days a user can book room in advance.")
            if(not len(error)):
                manager=request.session['username']
                manager=RoomManager.objects.get(username=manager)
                room.price=price
                room.no_of_days_advance=no_of_days_advance
                room.save()
                messages.info(request,"Room Data Updated Successfully")
                return redirect('/manager/dashboard1/')
            else:
                return redirect('/user/add-room/update/'+room.room_no,{"room":room})

In this module which is the index module of the Room Manager method.

  • The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “Room Manager” method.
from django.urls import path
from . import views
urlpatterns = [
    path('',views.dashboard,name="manager_dashboard"),
    path('new/',views.add_room,name="add_room"),
    path('update/<int:room_no>/',views.update_room,name="update_room"),

]

In this module which is the URL configuration module under Room Manager method.

The List Of Module Given Below Are Under The “Room Manager” Method

  • The Code Given Below Is For The “settings.py” Module – you can add the following code below into your “settings.py” under the “Room Slot” method.
import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'kd70*3-e22q4_2b33!ay*47kpo41g4_oduenmx9t3t4bvr7ynm'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'booking',
    'login',
    'room_manager',
    'customer',
    'rest_framework',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'room_slot.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR,'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'room_slot.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE =  'Asia/Kolkata'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'
# STATIC_ROOT=os.path.join(BASE_DIR,'static')
STATICFILES_DIRS=[
    os.path.join(BASE_DIR,'static')
]
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

In this module which is the index module of the Room Slot method.

  • The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “Room Slot” method.
from django.contrib import admin
from django.urls import path,include
from django.conf import settings
from django.conf.urls.static import static
from login import views
urlpatterns = [
    path('admin/', admin.site.urls),
    path('',include('booking.urls')),
    path('user/',include('login.urls')),
    path('manager/',include('login.urls')),
    path('logout',views.logout,name='logout'),
    path('api/',include('api.urls'))
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

In this module which is the URL configuration module under Room Slot method.

I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.

Downloadable Source Code Below.

Anyway, if you want to level up your programming knowledge, especially python, try this new article I’ve made for you Best Python Projects with source code for Beginners. But If you’re going to focus on web development using Django, you can download here from our list of Best Django Projects with source code based on real-world projects.

How To Run The Django Hotel Management System?

Step 1: Extract/unzip the file

Step 2: Go inside the project folder, open cmd and type the following commands to install Django Framework and run the webserver:

1.) pip install -r requirements.txt

2.) python manage.py runserver

Step 3: Finally, open the browser and go to localhost:8000

Summary

The system is built fully in Django Framework in back-end and HTML, CSS in front-end. It has full-featured user interface with all the functionalities

This Article is the way to enhance and develop our skills and logic ideas which is important in practicing the python programming language which is most well known and most usable programming language in many company.

Related article below

Inquiries

If you have any questions or suggestions about Django Hotel Management System, please feel free to leave a comment below.

1 thought on “Django Hotel Management System With Source Code”

Leave a Comment