Skip to content
Myr

Merge pull request #2131 from wgwz/add-larger-app-ex

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Add larger app ex

authored by Markus Unterwaditzer · committed by GitHub · parents 9900a72, 1b7258f · Browse files · 10 files+37 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+37 added−0 removed

  • tests:+12 added−0 removed
  • other:+25 added−0 removed

10 files+37 added−0 removed

modified:docs/patterns/packages.rst+5 added
15 unmodified lines
16 index.html17 login.html18 ...1920If you find yourself stuck on something, feel free21to take a look at the source code for this example.22You'll find `the full src for this example here`_.2324Simple Packages25---------------2627To convert that into a larger one, just create a new folder
105 unmodified lines
133 :ref:`becomingbig` section for some inspiration how to deal with that.134135136.. _working-with-modules:137.. _the full src for this example here: https://github.com/pallets/flask/tree/master/examples/patterns/largerapp138139Working with Blueprints140-----------------------141
4 unmodified lines
added:examples/patterns/largerapp/tests/test_largerapp.py+12 added
1from yourapplication import app2import pytest34@pytest.fixture5def client():6 app.config['TESTING'] = True7 client = app.test_client()8 return client910def test_index(client):11 rv = client.get('/')12 assert b"Hello World!" in rv.data
added:examples/patterns/largerapp/yourapplication/static/style.css
added:examples/patterns/largerapp/yourapplication/templates/index.html
added:examples/patterns/largerapp/yourapplication/templates/layout.html
added:examples/patterns/largerapp/yourapplication/templates/login.html
added:examples/patterns/largerapp/yourapplication/__init__.py+4 added
1from flask import Flask2app = Flask(__name__)34import yourapplication.views
added:examples/patterns/largerapp/yourapplication/views.py+5 added
1from yourapplication import app23@app.route('/')4def index():5 return 'Hello World!'
added:examples/patterns/largerapp/setup.py+10 added
1from setuptools import setup23setup(4 name='yourapplication',5 packages=['yourapplication'],6 include_package_data=True,7 install_requires=[8 'flask',9 ],10)
modified:tox.ini+1 added
8 unmodified lines
9commands =10 # We need to install those after Flask is installed.11 pip install -e examples/flaskr12 pip install -e examples/minitwit13 pip install -e examples/patterns/largerapp14 py.test --cov=flask --cov-report html []15deps=16 pytest17 pytest-cov
16 unmodified lines