This is a Library Management System built with Django. It allows users to borrow and return books, and manage user information.
- Python 3.x
- Django 3.x or higher
- pip (Python package installer)
- Git (optional, for cloning the repository)
- SQLite3 (for database management)
Follow these steps to set up the project on your local machine:
If you have Git installed, you can clone the repository using the following command:
git clone <repository-url>Alternatively, you can download the ZIP file from the repository and extract it.
cd library_managementIt is recommended to create a virtual environment to manage dependencies. Run the following commands:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`Install the required Python packages using pip:
pip install -r requirements.txtDownload and install SQLite3 from the official website: SQLite Download Page.
After installation, add the SQLite3 executable to your system PATH:
- Windows: Add the path to the SQLite3 executable to the
Pathenvironment variable. - Mac/Linux: Ensure the SQLite3 executable is in your system's PATH.
Create a .env file in the root directory of the project and add the following line:
DJANGO_SECRET_KEY='your-secret-key'Replace 'your-secret-key' with your actual secret key.
Open a terminal or command prompt and run the following command to create a new SQLite database named library_book:
sqlite3 library_book.dbThis will create a new file named library_book.db in your current directory.
By default, Django uses SQLite as the database. Ensure that the DATABASES setting in settings.py is configured to use SQLite:
# settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'library_book.db',
}
}Apply the database migrations to set up the database schema:
python manage.py migrateCreate a superuser to access the Django admin interface:
python manage.py createsuperuserFollow the prompts to set up the superuser account.
Start the Django development server:
python manage.py runserverOpen your web browser and navigate to http://127.0.0.1:8000 to access the application.
To access the Django admin interface, go to http://127.0.0.1:8000/admin and log in with the superuser credentials you created earlier.
library_management/: Main project directorylibrary/: Django app for managing books and user informationtemplates/: HTML templates for the applicationstatic/: Static files (CSS, JavaScript, images)requirements.txt: List of Python dependencies
You can customize the project by modifying the templates, static files, and Django views. Refer to the Django documentation for more information on how to work with Django projects.
This project is licensed under the MIT License. See the LICENSE file for more details.