Music Vibration is a musical venue and artist booking site that facilitates the discovery and bookings of shows between local performing artists and venues. This site lets you list new artists and venues, discover them, and list shows with artists as a venue owner.
This project is originally called Fyyur from Udacity's Advanced Web Development Nanodegree
This tech stack includes the following:
- virtualenv as a tool to create isolated Python environments
- SQLAlchemy ORM to be our ORM library of choice
- PostgreSQL as our database of choice
- Python3 and Flask as our server language and server framework
- Flask-Migrate for creating and running schema migrations
-
The Front-end for the project is based on HTML, CSS, and Javascript with Bootstrap 3 for our website's frontend.
-
Bootstrap can be installed by Node Package Manager (NPM). Therefore, if not already, download and install the Node.js.
-
Windows users must run the executable as an Administrator, and restart the computer after installation. After successfully installing the Node, verify the installation as shown below.
node -v
npm -v
├── README.md
├── app.py *** the main driver of the app. Includes your SQLAlchemy models.
"python app.py" to run after installing dependencies
├── config.py *** Database URLs, CSRF generation, etc
├── error.log
├── forms.py *** forms
├── requirements.txt *** The dependencies we need to install with "pip3 install -r requirements.txt"
├── static
│ ├── css
│ ├── font
│ ├── ico
│ ├── img
│ └── js
└── templates
├── errors
├── forms
├── layouts
└── pages
Models are located in the MODELS section of app.py
.
Controllers are also located in app.py
.
The web frontend is located in templates/
, which builds static assets deployed to the web server at static/
.
Web forms for creating data are located in forms.py
In order to run this project successfully, you will need to install and configure postgresql
If you don't have PostgreSQL installed, follow the instructions for your operating system.
- On Ubuntu/Debian:
sudo apt update
sudo apt install postgresql postgresql-contrib
- On macOS (using Homebrew):
brew install postgresql
-
On Windows:
Download and install PostgreSQL from https://www.postgresql.org/download/windows/. Follow the installer prompts to complete the installation.
- Ensure the PostgreSQL service is running: On Ubuntu/Debian:
sudo service postgresql start
- On macOS:
brew services start postgresql
-
On Windows:
Start the PostgreSQL service from the Start menu or use the Services window (services.msc) to start it.
Once PostgreSQL is installed and running, create a new database for your project:
sudo -u postgres psql
In the PostgreSQL shell, run the following commands:
CREATE DATABASE your_database_name;
CREATE USER your_user_name WITH PASSWORD 'your_password';
ALTER ROLE your_user_name SET client_encoding TO 'utf8';
ALTER ROLE your_user_name SET default_transaction_isolation TO 'read committed';
ALTER ROLE your_user_name SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_user_name;
Exit the PostgreSQL shell:
\q
In your project's configuration file (typically something like config.py or .env), set up the PostgreSQL connection.
For example, if you're using SQLAlchemy and .env:
DATABASE_URL=postgresql://your_user_name:your_password@localhost:5432/your_database_name
Make sure to replace your_user_name
, your_password
, and your_database_name
with the appropriate values.
Install the necessary packages to interact with PostgreSQL, such as psycopg2 and Flask-SQLAlchemy:
pip install -r requirements.txt
If your project requires initializing the database with tables, run the appropriate command for your application to create the necessary tables. For example, in Flask:
flask db upgrade
# Or if you're using a custom script:
python manage.py db init
git clone https://github.com/rawdaymohamed/music-vibration.git
cd music-vibration
Copy .env.example
and rename the new file to .env
:
Add your Postgresql database URL (explained above) to the .env file
python -m virtualenv venv
source venv/bin/activate
Note - In Windows, the env does not have a bin directory. Therefore, you'd use the analogous command shown below:
source venv/Scripts/activate
pip install -r requirements.txt
npm install
export FLASK_APP=myapp
export FLASK_ENV=development # enables debug mode
python3 app.py
Verify on the Browser
Navigate to project homepage http://127.0.0.1:5000/ or http://localhost:5000