Skip to content

Commit

Permalink
8 - Flask App as Package
Browse files Browse the repository at this point in the history
  • Loading branch information
codingforentrepreneurs committed Mar 7, 2019
1 parent 673af39 commit 18fbffa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 6 additions & 0 deletions landing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from flask import Flask

app = Flask(__name__)

from .views import *

12 changes: 2 additions & 10 deletions hello.py → landing/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
from flask import Flask

app = Flask(__name__)

# url
# view
from landing import app

@app.route("/")
def hello():
Expand All @@ -20,12 +15,9 @@ def about_us():

@app.route("/user/<username>/")
def profile(username):

return "<h1>Hello {username}</h1>".format(username=username)

@app.route("/jobs/<job_id>/")
def jobs(job_id):
# run job 12
return "<h1>Hello {username}</h1>".format(username=username)


return "<h1>Hello {username}</h1>".format(username=username)
2 changes: 1 addition & 1 deletion wsgi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from hello import app as application
from landing import app as application

if __name__ == '__main__':
application.run()

0 comments on commit 18fbffa

Please sign in to comment.