Skip to content
Merged
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: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pip install flask
touch app.py
```

## 3. Creating `app.py`
## 3. Creating `run.py`

```python
from flask import Flask
Expand All @@ -34,13 +34,13 @@ if (__name__ == "__main__"):
## 4. Running Flask Server

```bash
python app.py
python run.py
```

or

```bash
export FLASK_APP=app.py
export FLASK_APP=run.py
export FLASK_ENV=development # deprecated
export FLASK_DEBUG=1 # debug = True

Expand Down
16 changes: 0 additions & 16 deletions app.py

This file was deleted.

7 changes: 7 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from flask import Flask

app = Flask(__name__)

from app import views
from app import admin_views

11 changes: 11 additions & 0 deletions app/admin_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from app import app

# main route
@app.route("/admin/dashboard")
def index():
return "<h1>Admin dashboard</h1>"

# about page route
@app.route("/admin/profile")
def about():
return "<h1>Admin profile<h1>"
11 changes: 11 additions & 0 deletions app/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from app import app

# main route
@app.route("/")
def index():
return "Hello, world"

# about page route
@app.route("/about")
def about():
return "<h1>About page<h1>"
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
click==8.1.3
Flask==2.2.3
importlib-metadata==6.3.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.2
pkg_resources==0.0.0
Werkzeug==2.2.3
zipp==3.15.0
4 changes: 4 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from app import app

if (__name__ == "__main__"):
app.run(debug=True)