This is a Django-based web application for managing a bookstore. It provides functionality for user authentication, book management, and other core features required for running an online bookstore.
- User authentication and registration with Django Allauth
- Book management system
- Admin panel for managing content
- Custom user model
- Debug toolbar for development
- Backend: Django 4.2
- Database: PostgreSQL
- Frontend: Bootstrap 5 with Crispy Forms
- Authentication: Django Allauth
- Environment Management: Environs
- Development Tools: Django Debug Toolbar
-
Clone the repository:
git clone https://github.com/IAmKushagraSharma/Bookstore.git cd bookstore -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up the environment variables: Create a
.envfile in the root directory and add the following variables:DJANGO_SECRET_KEY=your_secret_key DJANGO_DEBUG=True # Set to False in production DJANGO_SECURE_SSL_REDIRECT=True DJANGO_SECURE_HSTS_SECONDS=2592000 DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS=True DJANGO_SECURE_HSTS_PRELOAD=True DJANGO_SESSION_COOKIE_SECURE=True DJANGO_CSRF_COOKIE_SECURE=True
-
Apply migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
The application uses PostgreSQL. Update the database settings in settings.py if necessary:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'bookstore',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': 'localhost',
'PORT': '5432',
}
}- Static files are located in the static/ directory.
- Media files are located in the media/ directory.
To run tests, use the following command:
python manage.py testFor deployment, ensure that the environment variables are properly set and debug mode is turned off. Use a WSGI server like Gunicorn and a web server like Nginx for serving the application.