Skip to content

Commit db6cd30

Browse files
committed
Added routes
1 parent 9bb48e6 commit db6cd30

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

routes/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from flask import redirect, request
2+
from app import app
3+
4+
@app.route('/test', methods=['GET'])
5+
def test_get():
6+
return '<form method="POST"><input name="username"></form>'
7+
8+
@app.route('/test', methods=['POST'])
9+
def test_post():
10+
username = request.form.get('username', '???')
11+
return 'Hello ' + username

run.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from app import app
22
from db import db
33
from models import article, source
4+
import routes
45

56
with app.app_context():
67
db.create_all()

0 commit comments

Comments
 (0)