PleatherStarfish / bom-squad

An inventory and search tool for DIY Eurorack synthesizer modules and components
GNU General Public License v3.0
21 stars 3 forks source link
bootstrap5 django reactjs

wide_logo

An inventory and search tool for DIY Eurorack synthesizer modules and components

Bom-Squad is a tool to help users source components for DIY SMT Eurorack modules. It allows users to

Getting started

Installing dependencies

The site is built using Django. In order to get your development environment set up, first ensure you have Python installed (version 3.8 or higher \<TBC>), and run the following commands in the directory where you have cloned this repository:

python -m pip install -r requirements.txt

Do not directly edit bom_squad/static/index.css or bom_squad/static/index.js. All CSS and Bootstrap is served from the bom_squad/static/index.css file, which is compiled from SCSS by Webpack. All ES6 is transpiled to bom_squad/static/index.js by the same Webpack config, which has multiple entry point for SCSS and JS files. To edit the SCSS styles you need to run

npm install 

in the bom_squad/static/static_editable/scss directory, which will download the required node_modules folder and install all the dependencies in bom_squad/static/static_editable/scss/package.json. You can then compile SCSS and transpile ES6 by running

npx webpack 

in the bom_squad/static/static_editable/scss directory.

Preparing your environment

Copy the files from _prereqs into bom_squad/secrets. In each file, replace the redacted API keys with your own API keys. (TODO: issue #9 needs to be done so that this is true for all secrets)

Now, create your local database by running:

python manage.py migrate

Finally, run the app with:

python manage.py runserver

Creating a local admin user

Run the following command and follow the instructions to create an admin user:

python manage.py createsuperuser

You can now access the admin console at http://127.0.0.1:8000/admin.

Editing SCSS/CSS and JavaScript Files

To edit SCSS files, find or create an appropriate file in the bom_squad/static/static_editable/scss directories, and ensure that the file is imported into the all.scss file in the same directory.

To edit miscellaneous JavaSript (as apposed to the React apps which are stored in certain app directories), edit in the bom_squad/static/static_editable/js directory. Note that the package.json file and webpack.config.js, etc. are all in the /scss/ directory, so you will need to run npx webpack in that directory in order to emit the transpiled JavaScript bundle which is loaded from static by the base.py template in Django.