Skip to content

A catalog web services system for the SE training program at Got It

Notifications You must be signed in to change notification settings

realThinhIT/gotit-catalog-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Catalog API System

Project Description

This is a web services system for the catalog web app, as a part in the SE training program at Got It.

This project is written in Python 2.7 and is being maintained by Thinh Nguyen (Victor), reviewed by Mr. Kien.

Documentation: https://realthinhit.github.io/gotit-catalog-api-docs/

Installation and Setup

  1. Install Python 2.7 on your machine.

  2. Clone this project.

$ mkdir ~/gotit-catalog-api
$ cd ~/gotit-catalog-api
$ git clone https://github.com/realThinhIT/gotit-catalog-api.git .
  1. Create an virtual environment with Virtualenv:
$ pip install virtualenv
$ cd ~/gotit-catalog-api
$ virtualenv venv --python=python2.7
$ source ~/gotit-catalog-api/venv/bin/activate

In case virtualenv can't be found in your PATH, try this command instead:

$ python -m virtualenv venv --python=python2.7
  1. Install project dependencies:
$ cd ~/gotit-catalog-api
$ pip install -r requirements.txt

Database Setup and Configurations

  1. Install mysql 5.7 and run the server:
$ mysql.server start
  1. Create a local development database or create other databases corresponding to the environments dev, test, production:
$ mysql -u root
mysql> create database catalog_dev
  1. Config SQLALCHEMY_DATABASE_URI URI connector in main/config to match your environment setup:
SQLALCHEMY_DATABASE_URI = 'mysql+mysqlconnector://{username}:{password}@127.0.0.1:3306/{database_name}'
  1. Config your secret key, SECRET_KEY in main/config/base.py.

  2. If you want some mockup data for staging, import mockup data using this command after running the server for the first time.

$ mysql -u {username} -p {database_name} < ./sql/test.sql

Start Server

Use the following commands to configure your preferred development environment or production environment (if needed).

By default, the server will be started in development environment.

$ export ENVIRONMENT={development/ production} # Default: development
$ export HOST="0.0.0.0" # Default: 0.0.0.0
$ export PORT=5000 # Default: 5000

Start the server:

$ python app.py

Testing

Use the following command to run tests. All tests are located in tests/.

After running this command, you'll get tests results (passed, failed, warning) and code coverage of the main folder.

$ ./run_tests.sh

Test Data

Test data is located at ./sql/test.sql.

About

A catalog web services system for the SE training program at Got It

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published