SonataCraft is a site where you can re-live the glory days of the baroque era, by playing a digital piano with that classic piano sound. The user can also practice sheet music, with the included sheet staff that displays the played notes. A page with information about other classical instruments is also included.
This project was created as a part of the September-24 Hackathon, hosted by Code Institute.
Team members:
Home page
Piano/play page
As a user, I want to land on a homepage that clearly introduces the website's purpose so that I can quickly understand what it offers.
Achieved by: The homepage includes a hero section with a brief introduction about the page, setting the tone for the user experience.
As a user, I want to have a clear choice between "Play" and "Learn" options on the homepage so that I can easily navigate to the section that interests me.
Achieved by: The "Choose Your Path" section on the homepage provides two distinct buttons: "Play" and "Learn."
As a user, I want to see navigation options in the navbar so that I can easily access different sections of the website.
Achieved by: The navbar at the top of the page provides links to these sections. The navbar is collapsed as a burger menu on smaller screens.
Home/landing page with welcome message. Buttons with links to play the piano, or learn about classical instruments.
Piano page with a playable piano, that also displays chords + music staff of the played keys. Includes instructions on how to play.
Learn page with cards for different classical instruments. The cards flip on hover, to display informational text.
About us page, with a card for each contributor. Includes links to github repos and LinkedIn.
For all testing, please refer to the TESTING.md file.
The live deployed application can be found deployed on Heroku.
This project uses a Code Institute PostgreSQL Database.
To obtain my own Postgres Database from Code Institute, I followed these steps:
Signed-in to the CI LMS using my email address.
An email was sent to me with my new Postgres Database.
[!CAUTION]
- PostgreSQL databases by Code Institute are only available to CI Students.
- You must acquire your own PostgreSQL database through some other method if you plan to clone/fork this repository.
- Code Institute students are allowed a maximum of 8 databases.
- Databases are subject to deletion after 18 months.
This project uses Whitenoise to store static files online, due to the fact that Heroku doesn't persist this type of data.
To install whitenoise, run the pip install whitenoise
command.
Edit your settings.py file and add WhiteNoise to the MIDDLEWARE list. The WhiteNoise middleware should be placed directly after the Django SecurityMiddleware (if you are using it) and before all other middleware:
MIDDLEWARE = [
# ...
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
# ...
]
This project uses Cloudinary for online static file storage.
To install Cloudinary, run the pip install cloudinary
and pip install dj3-cloudinary-storage
commands.
Edit your settings.py file and add cloudinary_storage and cloudinary to the INSTALLED_APPS list. Note that cloudinary_storage should be placed directly after the django.contrib.staticfiles.
INSTALLED_APPS = [
# ...
"django.contrib.staticfiles",
"cloudinary_storage",
# ...
"cloudinary",
]
To sign up for cloudinary, visit Cloudinary.com.
Once you've created a Cloudinary account and logged-in, follow these series of steps to get your project connected.
CLOUDINARY_URL=cloudinary://<your_api_key>:<your_api_secret>@<your_cloud_name>
This project uses Heroku, a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.
Deployment steps are as follows, after account setup:
Select New in the top-right corner of your Heroku Dashboard, and select Create new app from the dropdown menu.
Your app name must be unique, and then choose a region closest to you (EU or USA), and finally, select Create App.
From the new app Settings, click Reveal Config Vars, and set your environment variables.
[!IMPORTANT] This is a sample only; you would replace the values with your own if cloning/forking my repository.
Key | Value |
---|---|
CLOUDINARY_URL |
user's own value |
DATABASE_URL |
user's own value |
DISABLE_COLLECTSTATIC |
1 (this is temporary, and can be removed for the final deployment) |
SECRET_KEY |
user's own value |
Heroku needs three additional files in order to deploy properly.
requirements.txt
Procfile
runtime.txt
You can install this project's requirements (where applicable) using:
pip3 install -r requirements.txt
If you have your own packages that have been installed, then the requirements file needs updated using:
pip3 freeze --local > requirements.txt
The Procfile can be created with the following command:
echo web: gunicorn app_name.wsgi > Procfile
_replace app_name with the name of your primary Django app name; the folder where settings.py is located_
The runtime.txt file needs to know which Python version you're using:
type: python3 --version
in the terminal.
in the runtime.txt file, add your Python version:
python-3.12.6
For Heroku deployment, follow these steps to connect your own GitHub repository to the newly created app:
Either:
Or:
In the Terminal/CLI, connect to Heroku using this command: heroku login -i
Set the remote for Heroku: heroku git:remote -a app_name
(replace _appname with your app name)
After performing the standard Git add
, commit
, and push
to GitHub, you can now type:
git push heroku main
The project should now be connected and deployed to Heroku!
This project can be cloned or forked in order to make a local copy on your own system.
For either method, you will need to install any applicable packages found within the requirements.txt file.
pip3 install -r requirements.txt
.You will need to create a new file called env.py
at the root-level,
and include the same environment variables listed above from the Heroku deployment steps.
[!IMPORTANT] This is a sample only; you would replace the values with your own if cloning/forking my repository.
Sample env.py
file:
import os
os.environ.setdefault("CLOUDINARY_URL", "user's own value")
os.environ.setdefault("DATABASE_URL", "user's own value")
os.environ.setdefault("SECRET_KEY", "user's own value")
# local environment only (do not include these in production/deployment!)
os.environ.setdefault("DEBUG", "True")
Once the project is cloned or forked, in order to run it locally, you'll need to follow these steps:
Start the Django app: python3 manage.py runserver
Stop the app once it's loaded: CTRL+C
or ⌘+C
(Mac)
Make any necessary migrations: python3 manage.py makemigrations
Migrate the data to the database: python3 manage.py migrate
Create a superuser: python3 manage.py createsuperuser
Load fixtures (if applicable): python3 manage.py loaddata file-name.json
(repeat for each file)
Everything should be ready now, so run the Django app again: python3 manage.py runserver
If you'd like to backup your database models, use the following command for each model you'd like to create a fixture for:
python3 manage.py dumpdata your-model > your-model.json
repeat this action for each model you wish to backup
You can clone the repository by following these steps:
Go to the GitHub repository
Locate the Code button above the list of files and click it
Select if you prefer to clone using HTTPS, SSH, or GitHub CLI and click the copy button to copy the URL to your clipboard
Open Git Bash or Terminal
Change the current working directory to the one where you want the cloned directory
In your IDE Terminal, type the following command to clone my repository:
git clone https://github.com/Damitwhy/Team4-Sep2024-Hackathon.git
Alternatively, if using Gitpod, you can click below to create your own workspace using this repository.
Please note that in order to directly open the project in Gitpod, you need to have the browser extension installed.
A tutorial on how to do that can be found here.
By forking the GitHub Repository, we make a copy of the original repository on our GitHub account to view and/or make changes without affecting the original owner's repository.
You can fork this repository by using the following steps:
Log in to GitHub and locate the GitHub Repository
At the top of the Repository (not top of page) just above the "Settings" Button on the menu, locate the "Fork" Button.
Once clicked, you should now have a copy of the original repository in your own GitHub account!
There are no significant differences between local vs deployed version.
GitHub Projects served as an Agile tool for this project.
We started by coming together and creating wireframes to have an initial idea of the project. Once the ideation was complete, we divided up the tasks, and created issues for each of them. Issues were assigned, and the progress was tracked on the project board.
New issues were created and assigned as the project was progressing when new tasks arose.