Giter Site home page Giter Site logo

goldenrecord2's Introduction

Heavy Rotation

Created by Alma Frankenstein for Epicodus, 2020

Description

Welcome! Heavy Rotation is a blog where people can post the songs they've been listening to on repeat lately, and see what their friends are listening to.

Special thanks to Miguel Grinberg for his excellent book 'Flask Web Development' (O'Reilly, 2018) and many online tutorials.

Specs

Users can:

  • Post which songs they have on heavy rotation
  • Click a link to a posted song (if one has been added) and have that link open in a new browser tab
  • Follow other users and see their posts
  • Add 'about me' information to their profile

Other features include:

  • Pagination
  • Picture uploads
  • User authentication

Setup

To run on your localhost, clone this repo using:

git clone https://github.com/alma-frankenstein/heavy_proto.git heavyRotation

cd to the heavyRotation directory.

Install Python3, if you haven't already

Create a virtual environment for the project:

  • Run python3 -m venv venv
  • Activate it with source venv/bin/activate

Run pip install -r requirements.txt to install all dependencies

Create a migration repository for a database: flask db init

Add a subdirectory in the 'static' folder called 'avatars' (this folder is in .gitignore).

Still with the virtual environment activated, run flask run, then open the browser window indicated (this will probably be http://127.0.0.1:5000/). You should see the welcome page.

To add changes to the database:

  • Add the change to models.py
  • Run flask db migrate to generate a migration script
  • Then flask db upgrade to add the changes to the database

To run the test suite:

  • Make sure the virtual environment is activated (see above), then run python tests.py

Examining the Database: Some Basics

  • In the terminal with the virtrual environment activated, run flask shell

  • See all users:

    >>> users = User.query.all() https://github.com/alma-frankenstein/heavy_proto

    >>> users

  • Get user by ID:

    >>> userById = User.query.get([id])

  • See songs ordered by most recently added:

    >>> Song.query.order_by(timestamp.desc()).all()

  • If you have been added songs to test the app and would like to clear them all (same for users):

    >>> songs = Song.query.all()

    >>> for s in songs:

    ... db.session.delete(s)

    ...

    >>> db.session.commit()

    • In order for these changes to show, exit then restart the shell:

    >>> exit()

Technologies Used

  • Python
  • Flask
  • SQLAlchemy
  • Jinja2
  • Flask-Login
  • CSS

Helpful Resources

Known Bugs

No known bugs at this time.

Contact Details

For questions or to suggestions, please email [email protected]

License

This software is licensed under the MIT license.

Copyright (c) 2020 Alma Frankenstein

goldenrecord2's People

Contributors

alma-frankenstein avatar

Watchers

James Cloos 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.