Skip to content

Commit 47e8410

Browse files
authored
Merge pull request pallets#2131 from wgwz/add-larger-app-ex
Add larger app ex
2 parents 9900a72 + 1b7258f commit 47e8410

File tree

10 files changed

+37
-0
lines changed

10 files changed

+37
-0
lines changed

docs/patterns/packages.rst

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ this::
1717
login.html
1818
...
1919

20+
If you find yourself stuck on something, feel free
21+
to take a look at the source code for this example.
22+
You'll find `the full src for this example here`_.
23+
2024
Simple Packages
2125
---------------
2226

@@ -130,6 +134,7 @@ You should then end up with something like that::
130134

131135

132136
.. _working-with-modules:
137+
.. _the full src for this example here: https://github.com/pallets/flask/tree/master/examples/patterns/largerapp
133138

134139
Working with Blueprints
135140
-----------------------

examples/patterns/largerapp/setup.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='yourapplication',
5+
packages=['yourapplication'],
6+
include_package_data=True,
7+
install_requires=[
8+
'flask',
9+
],
10+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from yourapplication import app
2+
import pytest
3+
4+
@pytest.fixture
5+
def client():
6+
app.config['TESTING'] = True
7+
client = app.test_client()
8+
return client
9+
10+
def test_index(client):
11+
rv = client.get('/')
12+
assert b"Hello World!" in rv.data
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from flask import Flask
2+
app = Flask(__name__)
3+
4+
import yourapplication.views

examples/patterns/largerapp/yourapplication/static/style.css

Whitespace-only changes.

examples/patterns/largerapp/yourapplication/templates/index.html

Whitespace-only changes.

examples/patterns/largerapp/yourapplication/templates/layout.html

Whitespace-only changes.

examples/patterns/largerapp/yourapplication/templates/login.html

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from yourapplication import app
2+
3+
@app.route('/')
4+
def index():
5+
return 'Hello World!'

tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ commands =
1010
# We need to install those after Flask is installed.
1111
pip install -e examples/flaskr
1212
pip install -e examples/minitwit
13+
pip install -e examples/patterns/largerapp
1314
py.test --cov=flask --cov-report html []
1415
deps=
1516
pytest

0 commit comments

Comments
 (0)