Skip to content

Commit 3092916

Browse files
committed
Merge branch 'master' of github.com:JacobGrisham/Finance-Full-Stack-Web-App-using-Flask-and-SQLite
2 parents eedb022 + 67b2451 commit 3092916

File tree

1 file changed

+42
-24
lines changed

1 file changed

+42
-24
lines changed

README.md

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,45 @@
2020

2121
## 💡Lessons Learned
2222
- Database design and Create, Read, Update in SQL
23-
- Rewrote the entire application to use Flask SQL Alchemy
24-
- Developed MVP of application with SQLite locally and Deployed with MySQL on [RDS](https://aws.amazon.com/rds/) instance
25-
- Using Flask as a server-side framework
23+
- Rewrote the entire application to use [Flask SQL Alchemy](https://flask-sqlalchemy.palletsprojects.com/en/2.x/), an extension of [SQL Alchemy](https://www.sqlalchemy.org/)
24+
- Developed MVP of application with [SQLite](https://www.sqlite.org/index.html) locally and Deployed with [MySQL](https://www.mysql.com/)
25+
- Using [Flask](https://flask.palletsprojects.com/en/1.1.x/) as a server-side micro-framework
2626
- Python Class/Models and Schemas
27-
- Jinja templating
28-
- Password hashing using Werkzeug
27+
- [Jinja](https://jinja.palletsprojects.com/en/2.11.x/) templating
28+
- Password hashing using [Werkzeug](https://werkzeug.palletsprojects.com/en/1.0.x/)
29+
- Caching user sessions with [Redis](https://redis.io/) and [Flask-sessions](https://flask-session.readthedocs.io/en/latest/)
2930
- Parsing data from API with python
3031
- Parsing data from SQL queries with python
3132
- Calculations using data from API and database
32-
- Continous integration and continuous deployment with Travis CI
33-
- Deploying application to AWS with [Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) instance and SQL database to a separate [RDS](https://aws.amazon.com/rds/) instance
34-
- Using AWS Cloudfront as Content Delivery Network (CDN) and connecting Google Domains custom domain to AWS CDN
33+
- Hosting application on AWS with an [EC2](https://aws.amazon.com/ec2/) instance with an [Ubuntu](https://ubuntu.com/) operating system, [Gunicorn](https://gunicorn.org/) WSGI HTTP server, and [Nginx](https://www.nginx.com/) front-end reverse proxy
34+
- Using [Ubuntu](https://ubuntu.com/) as an operating system
35+
- [Gunicorn](https://gunicorn.org/) configuration and error-logging
36+
- [Nginx](https://www.nginx.com/) configuration and server security/performance optimization
37+
- Hosting MySQL database on AWS with a [RDS](https://aws.amazon.com/rds/) instance
38+
- Hosting Redis cache on AWS with an [Elasticache](https://aws.amazon.com/elasticache/) instance
39+
- Using AWS Cloudfront as a Content Delivery Network (CDN) and connecting Google Domains custom domain to AWS CDN
40+
- Error logging with [Sentry](https://sentry.io/welcome/) for hosted application in production
41+
- Continous integration and continuous deployment with [Travis CI](https://travis-ci.org/) and AWS CodeDeploy
42+
- (Deprecated) Hosting application on AWS with an [Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) instance and MySQL database on AWS with a [RDS](https://aws.amazon.com/rds/) instance
3543

3644
## 🛠 Technologies
37-
|Graphic Design|Front-End|Back-End|Database|Deployment|Testing|
38-
|------------- | ------- | ------ | ------ | -------- | -------|
39-
|Inkscape |HTML5 |Python3 |SQLite and MySQL |[AWS Elastic Beanstalk]() |Pytest|
40-
|. |CSS3 |[Flask](https://flask.palletsprojects.com/en/1.1.x/) |[SQL Alchemy](https://www.sqlalchemy.org/)|[AWS RDS](https://aws.amazon.com/rds/) |Lighthouse|
41-
|. |Bootstrap 4|[Werkzeug](https://werkzeug.palletsprojects.com/en/1.0.x/) |[Flask SQL Alchemy](https://flask-sqlalchemy.palletsprojects.com/en/2.x/) |Git |.|
42-
|. |[Jinja](https://jinja.palletsprojects.com/en/2.11.x/) |. |. |. |.|
45+
|Graphic Design |Front-End |Back-End |Database |Deployment |Testing |
46+
| ------------- | ------------- | ------------- | ------------- | ------------- | --------------|
47+
|Inkscape |HTML5 |Python3 |MySQL |AWS EC2 |Pytest |
48+
|Freepik |CSS3 |Flask |SQL Alchemy |Ubuntu |Lighthouse |
49+
|. |Bootstrap 4 |Werkzeug |Flask SQL Alchemy|Gunicorn |. |
50+
|. |Jinja |. |Redis |Nginx |. |
51+
|. |. |. |. |Sentry |. |
52+
|. |. |. |. |AWS RDS |. |
53+
|. |. |. |. |AWS Elasticache|. |
54+
|. |. |. |. |AWS Cloudfront |. |
55+
|. |. |. |. |Travis CI |. |
56+
|. |. |. |. |AWS CodeDeploy |. |
4357

4458
## ⚖️ Methodology
59+
- Initially hosted application on AWS [Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) for a gradual introduction to AWS. Previously only used Heroku to host full-stack web applications, so I chose a similar IaaS offered by AWS. After numerous Elastic Beanstalk policy changes and disconnections, decided to go to the next level down in AWS, which is hosting this application on an EC2 instance. This offered a lot of experience and opportunities for learning about web servers.
60+
- Ubuntu as OS since it's the most popular operating system for web servers. Gunicorn as the WSGI since it's fast. Nginx as the reverse proxy since it was made with this optimization in mind.
61+
- Initially stored user sessions in a tmp folder with [`mkdtemp`](https://docs.python.org/3/library/tempfile.html), however Nginx had trouble accessing it in production. Therefore refactored application to store user sessions in a Redis database and hosted the Redis database on AWS [Elasticache](https://aws.amazon.com/elasticache/).
4562

4663
## ⚙️ Features
4764
- Login, sign-up
@@ -52,8 +69,13 @@
5269

5370
## 🚀 Getting Started
5471
### To run this project on your system:
72+
- Ensure that `python3` and `python3-pip` are installed on your system
5573
- In your terminal, navigate to the root project directory and run the following commands
56-
- To install the dependencies
74+
- Activate the virtual environment
75+
```
76+
$ pipenv shell
77+
```
78+
- Install the dependencies
5779
```
5880
$ pipenv install -r requirements.txt
5981
```
@@ -65,10 +87,6 @@ $ pipenv install -r requirements.txt
6587
- Click API Tokens
6688
- Copy the key that appears under the Token column (it should begin with pk_) into the `<value>` in the next step
6789
- Create a .env file and paste the following into it: `API_KEY=<value>`
68-
- Activate the virtual environment
69-
```
70-
$ pipenv shell
71-
```
7290
- To start the web server, execute (without debugging):
7391
```
7492
$ python application.py
@@ -86,36 +104,36 @@ $ python
86104
$ from application import db
87105
$ db.create_all()
88106
```
89-
- To initialize the database with SQL command-line arguemnts:
107+
- To initialize the database with SQL command-line arguemnts (using MySQL syntax) run each `CREATE TABLE` command (one at a time):
90108
```
91109
CREATE TABLE users (
92110
id INTEGER PRIMARY KEY AUTO_INCREMENT,
93111
username VARCHAR(50) UNIQUE,
94112
hash VARCHAR(200) NOT NULL,
95113
cash INTEGER
96-
)
114+
);
97115
CREATE TABLE portfolio (
98116
id INTEGER PRIMARY KEY AUTO_INCREMENT,
99117
user_id INTEGER,
100118
symbol VARCHAR(5),
101119
current_shares INTEGER
102-
)
120+
);
103121
CREATE TABLE bought (
104122
id INTEGER PRIMARY KEY AUTO_INCREMENT,
105123
buyer_id INTEGER,
106124
time VARCHAR(100),
107125
symbol VARCHAR(5),
108126
shares_bought INTEGER,
109127
price_bought FLOAT
110-
)
128+
);
111129
CREATE TABLE sold (
112130
id INTEGER PRIMARY KEY AUTO_INCREMENT,
113131
seller_id INTEGER,
114132
time VARCHAR(100),
115133
symbol VARCHAR(5),
116134
shares_sold INTEGER,
117135
price_sold FLOAT
118-
)
136+
);
119137
```
120138

121139
## 📣 Attribution

0 commit comments

Comments
 (0)