- Flask - Python Based Web Framework Used
- Jinja2 - HTML Templating Language for Python
- Peewee - A small, expressive ORM used for database communications
- SQLite - SQL database engine
- python 3.11+
- linux, unix, mac, windows(with attachments)
- git
Open PowerShell as Administrator and check:
wsl --status
wsl -l -vIf WSL is not installed: wsl --install
After it is completed run wsl -l -v to see if Ubuntu is installed.
If Ubuntu is not installed run: wsl --install -d Ubuntu, then restart your laptop afterwards.
Then launch Ubuntu with: wsl.
- Check whether MySQL is already installed in PowerShell:
mysql --version. - You can also check the MySQL installation directory:
Get-ChildItem "C:\Program Files\MySQL" -ErrorAction SilentlyContinue. - From WSL, you can check the Windows MySQL installation in bash with:
ls "/mnt/c/Program Files/MySQL". - If MySQL GUI is not installed, download the MySQL Installer: https://dev.mysql.com/downloads/installer/
- You will see the prompt to log in or sign up instead choose “No thanks, just start my download.”
- During the installation process, you will be given the option to select client, server or both and you should choose both.
From WSL/Ubuntu check if python is installed:
python3 --version
pip3 --versionIf Python is not installed:
sudo apt update
sudo apt install python3 python3-pip python3-venvAfter installation, verify it again: python3 --version
Afterwards, go to: Running BCSR after the setup section
Check whether Homebrew is installed:
brew --version- If you receive:
command not found: brew - Install Homebrew by running the following command in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Then verify:
brew --version
- Check whether MySQL is installed:
mysql --version
brew list | grep mysqlIf MySQL is not installed go to the MySQL Community Server download page: https://dev.mysql.com/downloads/mysql/
Download the correct DMG:
- Apple Silicon: ARM64
- Intel Macs: x86_64
During setup, configure the MySQL root account. BCSR commonly uses:
- Username: root
- Password: root
If you use a different password, update app/secret_config.yaml.
Test the connection: mysql -u root -p
Check you installed Python version and pip:
python3 --version
pip3 --versionIf Python is not installed: brew install python
Navigate to your BCSR repository e.g.: cd ~/Desktop/SSDT/bcsr
On Windows, first enter WSL:
wslThen, on either Windows/WSL or macOS, run:
source setup.shYou should see (venv) at the beginning of your terminal prompt.
- During the setup, if you have this error:
-bash: setup.sh: line <something>: syntax error: unexpected end of file from "if" command on line 19go to the bottom of your IDE and find CRLF and click it to select LF
Note: In order for the application to work, you must activate the virtual environment.
Note: Also, If you ever want to deactivate the virtual environment for any reason just type
deactivateinto the terminal.
For MacOS:
- Check MySQL is running:
brew services list - If MySQL is stopped:
brew services start mysql
For Windows PowerShell (Administrator):
Note: For window users
*mysql*finds all mysql and you will see
- Check MySQL is running: Get-Service mysql
- Example:
| Status | Name | Display Name |
|---|---|---|
| Running | MySQL80 | MySQL80 |
| Stopped | MySQL84 | MySQL84 |
- Start the required service with:
Start-Service MySQL80(Replace MySQL80 with your service name).
- Run:
mysql -u root -p - If your password is root:
mysql -u root -proot - A successful connection will show:
mysql>
- Inside MySQL:
SHOW DATABASES; - If bcsr does not exist:
CREATE DATABASE bcsr;
USE bcsr;Run:
SELECT USER(), CURRENT_USER();
SHOW GRANTS FOR CURRENT_USER;If you see:
GRANT ALL PRIVILEGES ON `bcsr`.* TO `root`@`localhost`
or
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost`then the user already has the required access.
If the access is missing, grant it with:
GRANT ALL PRIVILEGES ON bcsr.* TO 'root'@'localhost'; FLUSH PRIVILEGES;Check which authentication plugin you are using:
SELECT user, host, plugin
FROM mysql.user
WHERE user = 'root';You may see something like: root | localhost | caching_sha2_password
Modern MySQL commonly uses: caching_sha2_password.
If the root account needs to be reset to use SHA authentication and the correct password, run:
ALTER USER 'root'@'localhost'
IDENTIFIED WITH caching_sha2_password BY 'root';Then refresh the privileges: FLUSH PRIVILEGES;
Verify again:
SELECT user, host, plugin FROM mysql.user WHERE user = 'root';The result should show: root | localhost | caching_sha2_password
Then test the login again: mysql -u root -p
WARNING:
create_db.pyis intended for development setup. Do not run this script against a production environment after real data exists.
Warning Make sure in your seceret_config.yaml the password and username under
dbmatch your mysql installation values.
Run:
python create_db.py
or
python3 create_db.pyConnect to MySQL:
mysql -u root -prootOnce connected, you should see the MySQL prompt:
mysql> Start BCSR with:
python app.py
or
python3 app.pyThe terminal will display a local URL. Open that URL in your browser to access the application.
- bcsr-flask
- App
-static
- js
- css
- img
-templates
- snips # A directory for partial html files
- start.html #This is an example of where your html files will go
-logic
- files that manipulate the database
- init.py
- allImports.py
- config.yaml
- models.py
- starty.py #This an example of where your controllers will go
- App
-static
- js
- css
- img
-templates
- snips # A directory for partial html files
- start.html #This is an example of where your html files will go
-logic
- files that manipulate the database
[TOC] #Installation#