1
- # flask-webapp-postgresql-db
1
+ # Python (Flask) Web App with PostgreSQL and Key Vault
2
2
3
- Artists Booking Venues powered by Python (Flask) and PostgreSQL Database
3
+ Artists Booking Venues powered by Python (Flask) and PostgreSQL Database.
4
+ There is no user authentication or per-user data stored.
4
5
5
- ## Development Setup
6
+ ![ Screenshot of website landing page ] ( ./repo-thumbnail.png )
6
7
7
- 1 . ** Download the project starter code locally **
8
+ The project is designed for deployment on Azure App Service with a PostgreSQL flexible server. See deployment instructions below.
8
9
9
- ``` bash
10
- git clone https://github.com/john0isaac/flask-webapp-postgresql-db.git
11
- cd flask-webapp-postgresql-db
12
- ```
10
+ [ ![ Open in GitHub Codespaces] ( https://github.com/codespaces/badge.svg )] ( https://codespaces.new/john0isaac/flask-webapp-postgresql-db?devcontainer_path=.devcontainer/devcontainer.json )
13
11
14
- 2. ** Before and After editing your code, Use the commands below: **
12
+ ![ Architecture Diagram: App Service, PostgreSQL server, Key Vault ] ( ./architecture-diagram.png )
15
13
16
- before editing anything pull new changes from GitHub.
14
+ ## Local Development
17
15
18
- ``` bash
19
- git pull
20
- ```
21
16
22
- Once you are done editing, you can push the local repository to your Github account using the following commands.
17
+ 1 . ** Download the project starter code locally **
23
18
24
- ``` bash
25
- git add .
26
- git commit -m " your comment message"
27
- git push
28
- ```
19
+ ``` bash
20
+ git clone https://github.com/john0isaac/flask-webapp-mysql-db.git
21
+ cd flask-webapp-mysql-db
22
+ ```
29
23
30
- 3 .** Initialize and activate a virtualenv using:**
24
+ 2 .** Initialize and activate a virtualenv using:**
31
25
32
26
``` bash
33
27
python -m virtualenv venv
@@ -41,13 +35,13 @@ source venv/Scripts/activate
41
35
deactivate
42
36
```
43
37
44
- 4 .** Install the dependencies:**
38
+ 3 .** Install the dependencies:**
45
39
46
40
``` bash
47
41
pip install -r requirements.txt
48
42
```
49
43
50
- 5 .** Run the development server:**
44
+ 4 .** Run the development server:**
51
45
52
46
``` bash
53
47
export FLASK_APP=app.py
@@ -56,40 +50,11 @@ export FLASK_DEBUG=true
56
50
flask run --reload
57
51
```
58
52
59
- 6 .** Verify on the Browser**
53
+ 5 .** Verify on the Browser**
60
54
61
55
Navigate to project homepage [ http://127.0.0.1:5000/ ] ( http://127.0.0.1:5000/ ) or [ http://localhost:5000 ] ( http://localhost:5000 )
62
56
63
- ## Adding Routes
64
-
65
- - Create the html, css, js in the specified folder using the same folder structure.
66
- - Create a new route in the [ app.py] ( ./app.py ) file with the name you want using only dashes to separate words.
67
-
68
- ``` PYTHON
69
- @app.route (' NEW-ROUTE' )
70
- ```
71
-
72
- - Define your serving function using a unique name not used before in the whole application.
73
-
74
- ``` PYTHON
75
- def NEW_UNIQUE_NAME ():
76
- ```
77
-
78
- - Return your html file path using render_template.
79
-
80
- ``` PYTHON
81
- return render_template(' FOLDER_PATH/FILE_PATH.html' )
82
- ```
83
-
84
- - Your newly created route should look like this.
85
-
86
- ``` PYTHON
87
- @app.route (' NEW-ROUTE' )
88
- def NEW_UNIQUE_NAME ():
89
- return render_template(' FOLDER_PATH/FILE_PATH.html' )
90
- ```
91
-
92
- ## Deploying to Google Cloud
57
+ ## Google Cloud Deployment
93
58
94
59
1 . Open the Google Cloud Shell and execute the following command:
95
60
@@ -126,7 +91,7 @@ env_variables:
126
91
gcloud app deploy app.yaml
127
92
```
128
93
129
- ## Deploying After Deleting Everything from Google Cloud
94
+ ### Deploying After Deleting Everything from Google Cloud
130
95
131
96
1 . Create a Cloud SQL instance using the following parameters:
132
97
- Specify instance name and password.
0 commit comments