-
-
Save Collinslenjo/294afa4a6a56252b8aa8bcec998f69b3 to your computer and use it in GitHub Desktop.
Minimal Flask application - Basic package design pattern Create a structure like this:
`./run.py`
`./webapp/__init__.py`
`./webapp/views.py`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # coding: utf-8 | |
| from flask import Flask | |
| app = Flask(__name__) | |
| import webapp.views |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # coding: utf-8 | |
| from webapp import app | |
| @app.route('/') | |
| def webapp(): | |
| return 'Hello World' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # coding: utf-8 | |
| from webapp import app | |
| if __name__ == '__main__': | |
| app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment