-
Notifications
You must be signed in to change notification settings - Fork 2
Onboarding for Devs (Windows)
Note: unless otherwise specified, commands listed in this guide are to be run in Powershell, run as administrator.
-
Get C++ Build Tools from this site
- Click the
Download Build Tools
button - Run the installer, and then select C++ build tools in the window that comes up
- Start the installation
- Note: the download can take rather long depending on network
- Restart your computer
- Click the
-
- You'll want the Windows x64 Installer (unless your machine is not 64 bit) listed in the binaries section on this page
-
Windows 11 Only: Zlib
- Run cmd.exe (Command Prompt) as an administrator
- Run the following command:
powershell -Command "(Invoke-WebRequest -Uri https://git.io/JnHTY -OutFile install_zlib.bat)"; ./install_zlib.bat; del install_zlib.bat
- ignore warnings about environment variables
-
-
winget
is a package manager for Windows, and is included by default with Windows 10 (May 2020 update and later), and all Windows 11 installations - To check if you have
winget
, open PowerShell as an administrator, and just runwinget
.- If it's installed, you'll get information about the command, and you can proceed.
- If it's not, you'll get an error message, naturally. I'm not sure at the moment if there is a reliable way to resolve if your Windows version is pre May 2020. Let me know if you don't have it installed and we can try a few different techniques.
-
-
Python 3.12, via
winget
- run
winget install Python.Python.3.12
- if the download progress in the console is very slow, install manually using the proper installer for your OS (most likely "Windows Installer (64-bit)) listed in the files section here
- Relaunch Powershell, then run
python --version
. If you see thePython 3.12.4
proceed to the next step.
- run
-
Make forks of the MusicCPR Repositories.
-
Clone your forks to your machine.
- This guide from the VSCode folks should help you get everything running smoothly
- Note: for the purposes of this setup you only need to read up to and including the section titled, "Clone a repository locally"
- I recommend making a folder to contain the two clones
- Once you have your clones, as a smoke test run
git remote -v
in a Powershell inside the clones' directories (can use VSCode integrated terminal, just ensure it is a powershell and not cmd or git bash), and ensure that your output looks like the following (backend shown here; you may not have upstreams listed and that's okay for now):origin https://github.com/Lab-Lab-Lab/CPR-Music-Backend-<your username>.git (fetch) origin https://github.com/Lab-Lab-Lab/CPR-Music-Backend-<your username>.git (push) upstream https://github.com/Lab-Lab-Lab/CPR-Music-Backend.git (fetch) upstream https://github.com/Lab-Lab-Lab/CPR-Music-Backend.git (push)
- This guide from the VSCode folks should help you get everything running smoothly
-
Node Version Manager
- Install using an installation executable found here
- Post-installer, open a Powershell and run
nvm --version
, and ensure your output shows a version number ofnvm
and not an error. - With
nvm
installed, runnvm install latest
in your Powershell. - Now within the parent directory of your two clones, or within the directory of your frontend clone if you chose not to keep the two clones in the same directory, look at the output and run the suggested version command
- Verify the correct version of node is being used locally, by running
node --version
; Your output should should confirm the version you are using
-
Postgres
- download and run the installer for postgresql >= 14.12 here
- select all 4 components during install
- enter a password when prompted, and DO NOT FORGET IT
- choose port 5432
-
Set up the database
- Launch pgadmin4, and in the Dashboard under Quick Links, click
Add New Server
- Under the
General
tab, give the server a meaningful name, MusicCPR is probably a good one, and is how the rest of the guide will reference it. - Under the
Connection
tab, enterlocalhost
in for "Host name/address", and ensure that the "Port" is5432
. - Still within the
Connection
tab, enter your password once more, toggle "Save password", and then hit "Save" - Right click the
MusicCPR
server and select "Create > Database"- Enter a name, I'm just using
teleband
- ensure the "Owner" is the user you've been using so far (most likely just
postgres
) - hit "Save"
- Enter a name, I'm just using
- Launch pgadmin4, and in the Dashboard under Quick Links, click
-
Make your local clone aware of the database
- create a file named
.env
inside yourCPR-Music-Backend
directory - add the following line:
DATABASE_URL=postgres://user:pass@localhost/teleband
- where
user
andpass
are the username and password you have been using thus far.
- create a file named
-
Set up and activate a virtual environment
- Within the parent directory of your cloned repositories run
py -3.12 -m venv musenv
-
cd
back into the backend directory - run
..\musenv\Scripts\Activate.ps1
- Your shell prompt should be prefixed with
(musenv)
-
NOTE: it is particularly important you run the
Activate.ps1
script in step (iii.) listed above from a Powershell instance.
- Within the parent directory of your cloned repositories run
-
Fetch the
media
folder from a teammate Media Folder- Paste it into your backend clone within the teleband directory
- ensure that from the VSCode file explorer sidebar, the
media
folder is "greyed out"
-
Install backend dependencies
- You MUST ensure several things before proceeding:
- You are in the backend clone's directory (you can verify by running
pwd
) - Your venv is activated, i.e., your shell prompt is prefixed with
(musenv)
or whatever you named your venv. - Your shell is using the correct python executable. To check, run
Get-Command python | fl *
. Make absolutely certain that forFile:
the corresponding entry is thepython.exe
within your venv folder, and NOT something like:C:\Users\<username>\AppData\Local\Programs\Python\Python312\python.exe
. Below is my output:
HelpUri : FileVersionInfo : File: C:\Users\mfwol\Documents\Thesis\actual-OS-resolve\musenv\Scripts\python.exe InternalName: Python Launcher OriginalFilename: py.exe FileVersion: 3.12.4 FileDescription: Python Product: Python ProductVersion: 3.12.4 ... Language: Language Neutral Path : C:\Users\mfwol\Documents\Thesis\actual-OS-resolve\musenv\Scripts\python.exe Extension : .exe Definition : C:\Users\mfwol\Documents\Thesis\actual-OS-resolve\musenv\Scripts\python.exe Source : C:\Users\mfwol\Documents\Thesis\actual-OS-resolve\musenv\Scripts\python.exe Version : 3.12.4150.1013 Visibility : Public OutputType : {System.String} Name : python.exe CommandType : Application ...
- Lastly, and ...DO NOT SKIP THIS: There are myriad problems with the combination of Windows, Pillow, psycopg2, and Python 3.12. So we need to tweak a few things:
- run the following manually:
python -m pip install --upgrade pip python -m pip install --upgrade Pillow python -m pip install --upgrade psycopg2
- You are in the backend clone's directory (you can verify by running
- Once you have absolutely ensured you have completed/verified the above tasks and checks, cross your fingers and run:
python -m pip install -r .\requirements.txt
- If that was error-free, cross your fingers once again and run database migrations with,
python manage.py migrate
- Make a superuser for the django admin pages by running
python manage.py createsuperuser
and follow the prompts- DO NOT FORGET YOUR USERNAME AND PASSWORD
- The email address you provide need not be a "real" address
- ...And if that was error-free, cross them once more and run
python manage.py runserver
. If your output is free of errors, pat yourself on the back, ya done good.
- You MUST ensure several things before proceeding:
you're probably like, how the !@#$ is there more???. Thankfully, as long as you got the preliminaries, frontend setup is fairly trivial.
- Set the correct version of node
- From your frontend clone's directory, run:
nvm use 22.3.0
-
DON'T SKIP THIS: check that it was successful by running
node --version
. Your output should bev22.3.0
. *If the expected version information is not displayed after running the command, open a new terminal session and try again. If the issue persists, restart your computer and reattempt the command.
- From your frontend clone's directory, run:
- run
npm i
- this is an alias for
npm install
, which installs all dependencies & dependencies of dependencies & dependencies of dependencies of dependencies (you get the point) for MusicCPR listed in package.json - it can take a minute so don't panic if it seems like it's hung
- don't worry about warnings; as long as there are no errors things are okay-ish
- throw caution to the wind and even ignore the anticipated single "high severity vulnerability"
- this is an alias for
- Launch it
- Make sure the backend is still running
- Cross your fingers for hopefully the last time and run
npm run dev
- In your browser, navigate to http://localhost:3000/
- Try to login with one of the demo users provided to you
And after all that, everything should be wunderbar
-
Check that your fork is in sync
- if it isn't, sync it up either using git from the command line, or github's option to sync on your fork's page
-
Launch the server/backend
- In a Powershell session within your backend clone activate the venv with
..\musenv\Scripts\Activate.ps1
- Check for migrations to be safe:
python manage.py migrate
- Login to the admin pages as your superuser at http://localhost:8000/admin/
- Note: do not kill/quit the server while working
- In a Powershell session within your backend clone activate the venv with
-
Start up the frontend
- In a Powershell session within your frontend clone, run:
npm run dev
- Navigate to http://localhost:3000/
- In a Powershell session within your frontend clone, run:
Have fun coding