This project is a mood-based music recommendation web application. Users can search for music based on mood, and the application will provide a list of songs that match the selected mood. The app is built with Flask for the backend and uses MySQL as the database.
- Search for songs by mood
- Displays a list of available moods
- Easy to use web interface
- Python 3.x
- MySQL server
- Git
- Clone the Repository:
git clone https://github.com/classidope/musicdb cd musicdb/
- Set Up a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install Dependencies:
pip install -r requirements.txt
- Set Up the Database:
- Import the MySQL database dump:
mysql -u root -p < musicdb_dump.sql
- Create a .env file in the root directory with the following content:
DB_NAME=musicdb DB_USER=root DB_PASSWORD=yourpassword DB_HOST=localhost
- Replace yourpassword with your MySQL password.
- Run the Application:
python run.py
- Access the Web Application: Open your browser and navigate to
text http://localhost:5000.
- On the home page, you'll see a list of default moods available in the database.
- Enter a mood into the search bar and click "Submit" to see songs that match the mood.
- The results page will display a list of songs matching the searched mood.
project-directory/
│
├── app/
│ ├── __init__.py
│ ├── routes.py
│ ├── templates/
│ │ ├── index.html
│ │ ├── results.html
│ ├── static/
│ └── (static files like CSS or images)
│
├── musicdb_dump.sql
├── run.py
├── requirements.txt
└── README.md
- Ensure MySQL is running and the credentials in the .env file are correct.
- If the app can't connect to the database, verify that musicdb_dump.sql was successfully imported.
To contribute:
- Fork this repository.
- Create a branch (git checkout -b feature-branch).
- Commit your changes (git commit -m 'Add some feature').
- Push to the branch (git push origin feature-branch).
- Open a Pull Request.
This project is licensed under the MIT License.
- Inspiration for this project came from a passion for music and programming.