Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Add Store and Add Product #24

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 150 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# FullStack Tutorial

[![](https://img.shields.io/badge/managed%20by-ppm-red)](https://jiangyiqun.github.io/ppm/)

In this fullstack tutorial, I will implement a simple CRUD App, including:
- A [Frontend](https://jiangyiqun.github.io/fullstack_tutorial/) using [JavaScript(React)](https://reactjs.org/)
- A [Backend](./docs/README.md) using [Python(Flask)](https://flask.palletsprojects.com/en/1.1.x/)

This CRUD App can manipulate a database which include a key and a pair of names, as follows:
- A [Frontend](./frontend/README.md) using [React.js](https://reactjs.org/)
- A [Backend](./backend/README.md) using [Python(Flask)](https://flask.palletsprojects.com/en/1.1.x/)
- Using the MySQL Database and [flask_mysqldb](https://flask-mysqldb.readthedocs.io/en/latest/) to Connect

![](./docs/Screenshot.png)
___

## Implementation

One of the fancy part of web app is that it is seperated by layers.

- The top layer is [frontend](./frontend), which utilises the [APIs](./docs) provided by backend. When implementing [frontend](./frontend), we can assume that all the [APIs](./docs) has already been implemented.
- The middle layer is [backend](./backend), which utilises the functions in [Model layer](./backend/dbms) to manipuate database. When implementing [backend](./backend), we assume that all the functions in [Model layer](./backend/dbms) has already been implemented.
- The bottom layer is [Model layer](./backend/dbms), which includes the implementation of manipulating database. I have provided a few implementations, they all have the same fuction interface.

You may start from any layer you prefer. If not sure, I recommend you to look at [APIs](./docs) first.
- The top layer is [frontend](./frontend), which is a React based project.
- The middle layer is [backend](./backend), which is a flask based python project.
- The bottom DB is a mysql Project, the ER diagram can be found here. [ER](./resources/ER_design.jpg)
47 changes: 7 additions & 40 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Flask Backend Deployment

THe backend uses [Model](./dbms) to implement [API](../docs), have a look at [main.py](./main.py)

## Run existing Backend Server

### Setup Server

```shell
```OPEN A CMD PROMPT AT BACKEND PATH
python3 -m venv python_modules # create python environment
source ./python_modules/bin/activate # activate python environment
python3 -m pip install -r package-lock.txt # install python modules from package.txt
./python_modules/bin/activate.bat # activate python environment for linux do not use the .bat one
python -m pip install -r package-lock.txt # install python modules from package.txt, YOU SHOULD SEE ALL PACKAGE BEING DOWNLOAD INTO python_modules
deactivate # deactivate python environment
```

**Alternatively, you could use [ppm](https://github.com/Jiangyiqun/ppm) (no available for Windows)**
**Linux can just use PPM**

```shell
ppm install
Expand All @@ -22,12 +21,12 @@ ppm install
### Run Server

```shell
source ./python_modules/bin/activate # activate python environment
./python_modules/bin/activate # activate python environment
python main.py # run back-end server
deactivate # deactivate python environment
```

**Alternatively, you could use [ppm](https://github.com/Jiangyiqun/ppm) (no available for Windows)**
**OR**

```shell
ppm start
Expand All @@ -36,44 +35,12 @@ ppm start
### Install new-package

```shell
source ./python_modules/bin/activate # activate python environment
./python_modules/bin/activate # activate python environment
pip install new-package # install new-package
python -m pip freeze > package-lock.txt # save new-package to package.txt
deactivate # deactivate python environment
```

**Alternatively, you could use [ppm](https://github.com/Jiangyiqun/ppm) (no available for Windows)**

```shell
ppm install new-package
```

## Create Backend from scratch

### Prerequisite

- [Anaconda (Python 3)](https://www.anaconda.com/distribution/#download-section)

### Create Flask App

```shell
mkdir backend
cd backend
python3 -m venv python_modules # create python environment
source ./python_modules/bin/activate # activate python environment
pip install flask flask-cors # install essitial modules
python -m pip freeze > package-lock.txt # save dependencies to package.txt
deactivate # deactivate python environment
```

**Alternatively, you could use [ppm](https://github.com/Jiangyiqun/ppm) (no available for Windows)**

```shell
mkdir backend
cd backend
ppm install
ppm install flask flask-cors # install essitial modules
```


## References
Expand Down
79 changes: 0 additions & 79 deletions backend/dbms/README.md

This file was deleted.

1 change: 0 additions & 1 deletion backend/dbms/dict_db/.gitignore

This file was deleted.

18 changes: 0 additions & 18 deletions backend/dbms/dict_db/README.md

This file was deleted.

Loading