This is a Django-based web application for managing inventory. The application allows users to browse, search, and manage items in the inventory. It also includes user authentication and authorization features. It is specifically tailored for Hayes Instrument Service to make keeping inventory much easier.
- User Authentication: Secure login and role-based access control
- User Management: Create, view, and delete users (Superuser only)
- Item Management: Create, update, use, and delete for items
- Item Browsing: Look through items with the search bar
- Item Requests: Make requests for new or existing items
- Data Import: Import item data from Excel Files
- Purchase Orders: Make a list of items to write to a purchase order Excel file
- Notifications: Mark notifications as read or delete them
| Role | Permissions |
|---|---|
| Superuser | Full access to all features, including user management and item creation. |
| Technician | Can create, delete, and update items. Can create and delete their own item requests. |
| Intern | Limited access to update items (only quantity). |
| Viewer | Can only view items and their details. |
This is the main programming language for the project. It is used for the backend logic, database interactions, and server-side scripting. Python is a versatile, easy-to-learn, and easy-to-use programming language that is widely used in web development.
More info about Python
This is the web framework used to build the application. Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides a robust set of features for building web applications, including an ORM (Object-Relational Mapping) system, authentication, and an admin interface.
More info about Django
The Haystack search framework has been implemented with the Whoosh backend for database searching. Whoosh is easy to set up and well-suited for small applications, which makes it an ideal choice for this application.
More info about Haystack and Whoosh
For writing to Excel files, OpenPyXL is used. It is a powerful library that allows for easy manipulation of Excel files in Python. This is used primarily for writing item data to an Excel file for purchase orders.
More info about OpenPyXL
| Software | Version |
|---|---|
| Git | 2.48.1 |
| Python | 3.13.2 |
The list of required software below will also be included in the requirements.txt file.
| Package | Version |
|---|---|
| coverage | 7.6.12 |
| Django | 5.2 |
| django-haystack | 3.3.0 |
| django-model-utils | 5.0.0 |
| freezegun | 1.5.1 |
| gunicorn | 23.0.0 |
| openpyxl | 3.1.5 |
| python-decouple | 3.8 |
| waitress | 3.0.2 |
| whitenoise | 6.9.0 |
| Whoosh | 2.7.4 |
- Go to the GitHub repository. (You're already here if the URL in your browser starts with "https://github.com/SierraTran/inventory_database"!)
- Click the Code button on the right side of the page.
- Select Download ZIP.
- Locate the downloaded ZIP file (usually in your "Downloads" folder).
- Extract all the files to a location of your choice.
- Download and install Python from the official Python website. At the time of writing this, the latest version of Python is 3.13.2.
- During installation, make sure to check the box that says Add Python to PATH.
-
Create a file named
.envin the root directory of the project (wheremanage.pyis located).- Important: Ensure that the
.envfile is excluded from version control to protect sensitive information like theDJANGO_SECRET_KEY. Add.envto your.gitignorefile if it is not already included.
- Important: Ensure that the
-
Add the following environment variables to the
.envfile:DJANGO_SECRET_KEY=your-secret-key DEBUG=False ALLOWED_HOSTS=localhost,127.0.0.1 -
Replace
your-secret-keywith a strong, unique key. To generate this key:-
Open a terminal or command prompt. You can do this by pressing
Win + R, typingcmd, and pressing Enter on Windows. On Mac, you can open the Terminal app from the Applications folder. If you're using Linux, open the terminal from your applications menu. -
Copy and paste the following command and press Enter:
py -c "import secrets; print(secrets.token_urlsafe(50))"- Note: This command uses
pyto run Python on Windows. If you're using Linux or Mac, you can usepython3orpythoninstead.
- Note: This command uses
-
This will output a long, random string. It will look something like this:
n3w5tr0ng53cr3tK3y-EXAMPLE-1234567890 -
Copy this string and paste it into the
DJANGO_SECRET_KEYvariable in the.envfile. The variable should look something like this now:DJANGO_SECRET_KEY=n3w5tr0ng53cr3tK3y-EXAMPLE-1234567890
-
-
Set
DEBUGtoTruefor development and debugging. For production, set toFalse -
Update
ALLOWED_HOSTSwith the domain names or IP addresses you want the application to run on.- For local development:
localhost,127.0.0.1 - For production: Add your domain name (e.g.,
example.com)
- For local development:
-
Save the
.envfile.
This requires more technical knowledge, specifically for navigating directories on a command line.
- Open a terminal or command prompt.
cdto the directory of the application.- Run the command
py manage.py makemigrationsand thenpy manage.py migrate. This will set up the database tables for authentication. - Run the command
py manage.py createsuperuser. - You will be asked to input a username, email address, and password for the superuser. The email address is optional and can be left blank. You will need to confirm your password by typing it again when prompted.
- Once the superuser has been successfully created, you can use the credentials to log in to the Inventory Database application.
-
Open the folder where you extracted the files.
-
There are two files:
deploy.batanddeploy.sh. These files are used to run the application. Choose the one that matches your operating system:-
For Windows: Double-click
deploy_windows.batto run the application. -
For Mac/Linux: Open a terminal, navigate to the folder where you extracted the files, and run the following command:
chmod +x deploy_mac_linux.sh ./deploy_mac_linux.sh
-
- Navigate to the application's URL in your browser.
- Enter your username and password to log in.
- Depending on your role, you will see different options on the home page.
- Provides quick links to:
- Browse all items
- Create new items (if permitted)
- Import item data from Excel
- Make new item requests
- Manage users (Superuser only)
- View notifications
- Go to the Items Page to see a list of all inventory items.
- Use the search bar at the top to filter items by name, description, or other attributes by full words.
- Click on an item to view its details.
- Shows detailed information about the selected item, including quantity, description, and other fields.
- Depending on your role:
- Technician/Superuser: Can edit or delete the item.
- Intern: Can update the quantity.
- Viewer: Can only view item details.
- Users with appropriate permissions (Technician/Superuser) can create new items using the "Add Item" button.
- Fill in the required fields and submit the form.
- Edit or delete items from their detail pages.
- Use the "Import Items" option to upload an Excel file (.xlsx) containing item data.
- Follow on-screen instructions to map columns and confirm import.
- Request new items or additional quantities using the "Request Item" feature.
- View and manage your requests from the Item Requests page.
- Add items to a purchase order list.
- Export the list to an Excel file for processing orders.
- View notifications about inventory changes, requests, or approvals.
- Mark notifications as read or delete them directly from the notifications page.
- Superusers: Can create, view, and delete users.
- Other users: Can view the list of users and their details.
- Click the "Logout" link in the navigation bar to securely end your session.
- Seamless Notification Management: Users can mark and delete notifications directly from the notifications page, avoiding unnecessary navigation.
- Help page and/or messages: Users can refer to an extensive page or contextual messages throughout the application for guidance.
- "Shopping Cart" for Items: Users can add items to a list for purchasing. This list will serve as a temporary holding area for selected items, which can then be reviewed and finalized before being used to populate purchase order forms on the application.
- Export Inventory to Excel: Users can generate an Excel file for reports, audits, and backup offline copies.
- Images for Items: A picture of the item is shown on the details page for easier recognition in real-world use cases (finding the item in the building, counting how many there are, etc.).
Feel free to fork the repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
- When running tests, your computer's antivirus may be alerted and think the program is ransomware. This is because of files in the
whoosh_indexfolder being created, modified, and deleted during testing. This only affects thewhoosh_indexfiles. For now, tests for the search indexes have been commented out so they won't be run.- To re-enable these tests, locate the commented-out test cases in the test files (usually in the
testsdirectory) and uncomment them. Ensure your antivirus software is configured to allow modifications to thewhoosh_indexfolder during testing.
- To re-enable these tests, locate the commented-out test cases in the test files (usually in the
Sierra Tran
Email: [email protected]
This project is licensed under the MIT License - see the LICENSE file for details.