Package: django-bom
BOMBOM is a simple Django app to manage a bill of materials. It supports multiple part numbering schemes, tracking component sourcing information, estimates costs, and contains smart integrations with Mouser to pull in the latest component pricing and Google Drive for part file management. BOM is written in Python 3 and Django 3.See a live example.BOM can be added to an existing (or new) Django project, or stand alone on its own, which can be more convenient if you're interested in tweaking the tool.If you already have a django project, you can skip toAdd Django Bom To Your App, otherwiseStart From Scratch: Add to new Django projectto add it to a new django project, orStart From Scratch: Use as standalone Django project.Table of contentsStart From Scratch: Add to new Django projectAdd Django Bom To Your AppStart From Scratch: Use as standalone Django projectCustomize Base TemplateIntegrationsContributingInstallation pitfallsStart From Scratch: Add to a new Django projectTo start from scratch we recommend setting up a virtual environment using Python 3.8.13virtualenv -p python3 mysite
cd mysite
source bin/activateFrom here install django, and set up your project.pip install django
django-admin startproject mysite
cd mysite
python manage.py migrate
python manage.py createsuperuser # make a user for your development environmentContinue on toAdd Django Bom To Your App.Add Django Bom To Your Appdjango-bom is areusable django application. If you don't already have a django project, you can follow some quick steps below to get up and running, or read about creating your first django apphere.pip install django-bomAdd "bom" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [
    ...
    'bom',
    'social_django', # to enable google drive sync in bom
    'djmoney', # for currency
    'djmoney.contrib.exchange', # for currency
    'materializecssform',
]Update your URLconf in your project urls.py like this::path('bom/', include('bom.urls')),And don't forget to import include:from django.conf.urls import includeUpdate your settings.py to add the bom context processor'bom.context_processors.bom_config',to your TEMPLATES variable, and create a new empty dictionary BOM_CONFIG.TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'bom.context_processors.bom_config',
            ],
        },
    },
]andBOM_CONFIG = {}Runpython manage.py migrateto create the bom models.Start the development serverpython manage.py runserverand visithttp://127.0.0.1:8000/admin/to manage the bom (you'll need the Admin app enabled).Visithttp://127.0.0.1:8000/bom/to begin.Start From Scratch: Use as a standalone Django projectTo start from scratch we recommend setting up a virtual environmentvirtualenv -p python3 mysite
cd mysite
source bin/activateFrom here install django, and set up your project.git clone https://github.com/mpkasp/django-bom.git
pipenv install
python manage.py migrate
cp bom/local_settings.py.example bom/local_settings.py
python manage.py runserverCustomize Base TemplateThe base template can be customized to your pleasing. Just add the following configuration to your settings.py:BOM_CONFIG = {
    'base_template': 'base.html',
}wherebase.htmlis your base template.IntegrationsMouser IntegrationFor part matching, make sure to add your Mouser api key. You can get your keyhere.Google Drive IntegrationMake sure to add the following to your settings.py:AUTHENTICATION_BACKENDS = (
    'social_core.backends.google.GoogleOpenId',
    'social_core.backends.google.GoogleOAuth2',
    'social_core.backends.google.GoogleOAuth',
    'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = ['email', 'profile', 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/plus.login']
SOCIAL_AUTH_GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS = {
    'access_type': 'offline',
    'approval_prompt': 'auto'
}And if you're using https on production add:SOCIAL_AUTH_REDIRECT_IS_HTTPS = not DEBUGFIXERFixer.io is used to handle exchange rate calculations. This is helpful if you may be purchasing parts from another currency (especially via Mouser) and you still need to estimate your part costs.To set this up you just need to add your API key to local_settings.py as shown in the example.To update rates, migrate and runpython manage.py update_rates. Some day we will need to add a (celerybeat?) task to update rates on a schedule. Explained morehere.ContributingContributions welcome! Before contributing your work please read thecontributing readme.Also reach out tomike@indabom.comto discuss features, and join our slack channel.Installation PitfallsWindowsSqliteYou may get an error during yourpip install -r requirements.txtrelated to sqlite. This may be fixed by installing Visual C++ for python...CryptographySometimes you'll have issues installing cryptography, if this is the case you may just need to set up some environment variables. Thisstackoverflowmay help.