-
Notifications
You must be signed in to change notification settings - Fork 0
/
flow.text
38 lines (29 loc) · 1.24 KB
/
flow.text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
People-News
1. Created our flask file structure;
app - templates
static
__init__.py
config.py
error.py
views.py
license
readme.md
run.py
gitignore - virtual/
2. Created our virtual environment and added it in the gitignore file.
3. All flask applications must create an application instance.
from flask import Flask
app = Flask (__name__) - we create an instance of the class called app by passing in the __name__ variable.
4. Create our index page view functions
from flask import render_template - function that automatically searches for the template file in our app/templates/
sub directory and loads it.
from app import app
@app.route('/') - route decorator
def index(): - view function
'''
View root page function that returns the index page and its data
'''
5. Created an index.html file in app/templates/
used b4-$ shortcut for our html structure with bootstrap cdn links.(might delete later on when importing macros and download
bootstrap manually)
6. Run the application - imported app from app and called the main function.