Giter Club home page Giter Club logo

todo-app's Introduction

SAMPLE VERSION OF TODO APP

This app is written in Python with Flask and SQLAlchemy, as a part of the Udacity's Full Stack Web Developer Nanodegree program.

Demo

image

A. Dependency

In order to run this app, the following dependencies must have been already installed:

  1. Postgres.
  • Start manually: pg_ctl -D /usr/local/var/postgres start
  • Stop manually: pg_ctl -D /usr/local/var/postgres stop -s -m fast
  1. Flask

B. Database

The database relations todos(id, description, complete, list_id) and todolists(id, name) must have been already created in Postgres. We have assumed that the Postgres is running on default port 5432.

  • dropdb todoapp -p 5432 && createdb todoapp -p 5432
  • Open the database prompt - psql -p 5432
  • Connect to the database - \c todoapp
  • Displays the tables in the database \dt
  • Displays the schema of the 'todos' table \d todos
  • Displays the schema of the 'todolists' table \d todolists

image

You can insert a few rows in both the tables. Insert first in the todolists relation.

C. Steps to Run the App:

First of all locate to app directory using: cd todoapp

1. Setting up the virtual environment for Pyhton

  • python3 -m venv env set the virtual environment for Pyhton
  • source env/bin/activate activate the venv

2. Intall dependencies

  • python -m pip install -r requirements.txt to install dependencies. For Mac users, if you face difficulty in installing the psycopg2, you may consider intalling the sudo brew install libpq before running the requirement.txt.

3. Setting up for database

  • flask db init to create the migrations directory structure
  • dropdb todoapp if you already have it
  • createdb todoapp
  • flask db migrate (Detects the model changes to be made and creates a migration file with upgrade and downgrade logic setup.
  • Using flask db uprade when you want to commit your changes to database
  • Using flask db migrate when you want to rollback the changes.

4. Running

todo-app's People

Contributors

khoivukha avatar

Stargazers

 avatar

Watchers

 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.