Skip to content

Commit 8a53ddc

Browse files
committed
update readme
1 parent 492b112 commit 8a53ddc

File tree

1 file changed

+60
-38
lines changed

1 file changed

+60
-38
lines changed

Diff for: README.md

+60-38
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,88 @@
1-
# Flask-WebApp-with-PostgreSQL-DB
1+
# flask-webapp-postgresql-db
2+
23
Artists Booking Venues powered by Python (Flask) and PostgreSQL Database
34

45
## Development Setup
6+
57
1. **Download the project starter code locally**
6-
```
7-
git clone https://github.com/John0Isaac/Flask-WebApp-with-PostgreSQL-DB.git
8-
cd Flask-WebApp-with-PostgreSQL-DB
9-
```
108

11-
2. **Before and After editing your code, Use the commands below:**
9+
```bash
10+
git clone https://github.com/john0isaac/flask-webapp-postgresql-db.git
11+
cd flask-webapp-postgresql-db
12+
```
13+
14+
2.**Before and After editing your code, Use the commands below:**
1215

1316
before editing anything pull new changes from GitHub.
14-
```
17+
18+
```bash
1519
git pull
1620
```
21+
1722
Once you are done editing, you can push the local repository to your Github account using the following commands.
18-
```
23+
24+
```bash
1925
git add .
2026
git commit -m "your comment message"
2127
git push
2228
```
2329

24-
3. **Initialize and activate a virtualenv using:**
25-
```
30+
3.**Initialize and activate a virtualenv using:**
31+
32+
```bash
2633
python -m virtualenv venv
2734
source venv/bin/activate
2835
```
36+
2937
>**Note** - In Windows, the `venv` does not have a `bin` directory. Therefore, you'd use the analogous command shown below:
30-
```
38+
39+
```bash
3140
source venv/Scripts/activate
3241
deactivate
3342
```
3443

35-
4. **Install the dependencies:**
36-
```
44+
4.**Install the dependencies:**
45+
46+
```bash
3747
pip install -r requirements.txt
3848
```
3949

40-
5. **Run the development server:**
41-
```
50+
5.**Run the development server:**
51+
52+
```bash
4253
export FLASK_APP=app.py
4354
export FLASK_ENV=development
4455
export FLASK_DEBUG=true
4556
flask run --reload
4657
```
4758

48-
6. **Verify on the Browser**<br>
59+
6.**Verify on the Browser**
60+
4961
Navigate to project homepage [http://127.0.0.1:5000/](http://127.0.0.1:5000/) or [http://localhost:5000](http://localhost:5000)
5062

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.
5167

52-
# Adding Routes
53-
## To add a new page
54-
* Create the html, css, js in the specified folder using the same folder structure.
55-
* Create a new route in the [app.py](./app.py) file with the name you want using only dashes to seperate words.
5668
```PYTHON
5769
@app.route('NEW-ROUTE')
5870
```
59-
* Define your serving function using a unique name not used before in the whole application.
71+
72+
- Define your serving function using a unique name not used before in the whole application.
73+
6074
```PYTHON
6175
def NEW_UNIQUE_NAME():
6276
```
63-
* Return your html file path using render_template.
77+
78+
- Return your html file path using render_template.
79+
6480
```PYTHON
6581
return render_template('FOLDER_PATH/FILE_PATH.html')
6682
```
67-
* Your newely created route should look like this.
83+
84+
- Your newly created route should look like this.
85+
6886
```PYTHON
6987
@app.route('NEW-ROUTE')
7088
def NEW_UNIQUE_NAME():
@@ -75,19 +93,20 @@ def NEW_UNIQUE_NAME():
7593

7694
1. Open the Google Cloud Shell and execute the following command:
7795

78-
```
79-
git clone https://github.com/John0Isaac/Flask-WebApp-with-PostgreSQL-DB.git
80-
cd Flask-WebApp-with-PostgreSQL-DB
81-
```
96+
```shell
97+
git clone https://github.com/john0isaac/flask-webapp-postgresql-db.git
98+
cd flask-webapp-postgresql-db
99+
```
82100

83-
2. Create the env_variables.yaml file that contains your secret environment variables.
101+
2.Create the env_variables.yaml file that contains your secret environment variables.
84102

85-
```
86-
nano env_variables.yaml
87-
```
103+
```shell
104+
nano env_variables.yaml
105+
```
88106

89-
3. Add your Google Cloud SQL database connection details
90-
```
107+
3.Add your Google Cloud SQL database connection details
108+
109+
```shell
91110
env_variables:
92111
DB_USER_NAME: 'secret'
93112
DB_PASSWORD: 'secret'
@@ -99,14 +118,16 @@ env_variables:
99118
DEPLOYMENT_LOCATION: 'gcp'
100119
```
101120

102-
4. save and exit the file CTRL+x followed by y followed by Enter.
103-
5. Deploy the web application.
104-
```
105-
gcloud app deploy app.yaml
106-
```
121+
4.save and exit the file CTRL+x followed by y followed by Enter.
122+
123+
5.Deploy the web application.
107124

125+
```shell
126+
gcloud app deploy app.yaml
127+
```
108128

109129
## Deploying After Deleting Everything from Google Cloud
130+
110131
1. Create a Cloud SQL instance using the following parameters:
111132
- Specify instance name and password.
112133
- Select production instead of production plus.
@@ -118,6 +139,7 @@ gcloud app deploy app.yaml
118139
- Create a database and call it fyyur.
119140
- Create a user and call it john.
120141
- Grant All privileges to user john.
142+
121143
2. Import Data dump.
122144
3. Pull the code to the Cloud Shell.
123145
4. Create environment variables .yaml file.

0 commit comments

Comments
 (0)