Coder Social home page Coder Social logo

udacity-fyyur's Introduction

Fyyur

Introduction

Fyyur 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.

We want Fyyur to be the next new platform that artists and musical venues can use to find each other, and discover new music shows. Let's make that happen!

Tech Stack (Dependencies)

If you are developing the app further, you will need to set up the developer environment. For this, we use pipenv. You can find instructions on how to set it up here. It is the preferred way to set up a python environment, replacing the use of a requirements file.

1. Backend Dependencies

Our tech stack will include 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 You can download and install the dependencies mentioned above using pipenv as:
pipenv install && pipenv shell

If you also want the dev packages, simply add the --dev flag, like so

pipenv install --dev && pipenv shell

2. Frontend Dependencies

You must have the HTML, CSS, and Javascript with Bootstrap 3 for our website's frontend. Bootstrap can only 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

Install Bootstrap 3 for the website's frontend:

npm init -y
npm install bootstrap@3

Overall:

  • Models are located in the models.py file.
  • Controllers are 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 form.py

Highlight folders/files:

  • templates/pages -- Defines the pages that are rendered to the site. These templates render views based on data passed into the template’s view, in the controllers defined in app.py. These pages successfully represent the data to the user.
  • templates/layouts -- Defines the layout that a page can be contained in to define footer and header code for a given page.
  • templates/forms -- Defines the forms used to create new artists, shows, and venues.
  • app.py -- Defines routes that match the user’s URL, and controllers which handle data and renders views to the user. This is the main file you will be working on to connect to and manipulate the database and render views with data to the user, based on the URL.
  • models.py -- Defines the data models that set up the database tables.
  • config.py -- Stores configuration variables and instructions, separate from the main application code. This is where you will need to connect to the database. You can use an environment variable DATABASE_URL to define the connection.
  • .env -- You need to define your own .env file and have the following variables defined:
FLASK_APP=app
FLASK_ENV=development
DATABASE_URL="postgresql://fyyurapp:fyyurpassword@localhost:5432/fyyur"

You can obviously replace the DATABASE_URL with your own. This file should not be committed to github and has been added to the .gitignore file. When you run pipenv shell, the .env file is automatically loaded into the environment.

3. Docker and Makefile

You can use docker to bring up a postgres service to use with this project.

Files for docker:

  • docker-compose.yml -- Defines the postgres service that will work with the default connection specified in config.py under SQLALCHEMY_DATABASE_URI which is used when DATABASE_URL is not specified.
  • Makefile -- Defines the instruction make db which you can use to bring up the postgres service with docker. Docker should be running when you run this command

4. Seed data

If you wish to have some example records in the database, you have the following tools:

Files for seed data:

  • data.py -- A collection of data points. These can also be used for tests.
  • load_data.py -- The instructions necessary to load the data from data.py into the database, including upgrading the database using flask-migrate

To load the seed data into the database, use:

python load_data.py

Your databse should be accessible for this to work.

Development Setup

  1. Download the project starter code locally
git clone https://github.com/aj-cloete/udacity-fyyur.git
cd udacity-fyyur
  1. Initialize and activate a pipenv using:
pipenv install --dev
pipenv shell
  1. Install the dependencies:
pip install -r requirements.txt
  1. Run the development server:
export FLASK_APP=app # link to your app.py file
export FLASK_ENV=development # enables debug mode
flask run
  1. Verify on the Browser
    Navigate to project homepage http://127.0.0.1:5000/ or http://localhost:5000

udacity-fyyur's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.