Skip to content

jruizvar/project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 

Repository files navigation

Project Description

This web application executes the CRUD operations on a relational database. The application uses the SQLite library to implement a transactional SQL database engine. SQLite is convenient because it doesn't require setting up a separate database server and it is built-in to Python.

The application's directory is called crudy, and the project layout looks like this:

├── db.py
├── __init__.py
├── main.py
├── menu.py
├── orders.py
├── pool.py
├── schema.sql
├── static
│   └── style.css
└── templates
    ├── base.html
    ├── index.html
    ├── menu
    │   ├── create.html
    │   ├── update.html
    │   └── view.html
    ├── orders
    │   ├── create.html
    │   ├── update.html
    │   └── view.html
    └── pool
        ├── create.html
        └── view.html

Connect to the Database

The connection to the SQLite database is established via sqlite3.connect().

Data Tables

The database schema is created before we store or retrieve any data.

CRUD Operations

The CRUD operations are implemented in several places of the application. Follow the links below for details.

Instructions

The application was written in Python 3.6 with the microframework Flask. We recommend Miniconda package management system to create the development environment.

  • Create Environment
conda create -n crudy python=3 mongodb
source activate crudy
  • Install Dependencies
pip install flask flask-bootstrap flask-wtf pandas pymongo
  • Download Project
git clone https://github.com/jruizvar/project.git
cd project
  • Environment Setup
export FLASK_APP=crudy
export FLASK_ENV=development
  • Initialize Databases
flask init-db

The directory instance containing the file crudy.sqlite is created. Run the MongoDB service in another terminal.

mkdir instance/mongodata
mongod --dbpath instance/mongodata
  • Execute Application
flask run

By default, the application starts running on http://localhost:5000/