Commit graph

2699 commits

Author SHA1 Message Date
jab
8a2db3db18 Change Flask.__init__ to accept two new keyword arguments, host_matching and static_host. (#1560)
This enables host_matching to be set properly by the time the constructor adds
the static route, and enables the static route to be properly associated with
the required host.

Previously, you could only enable host_matching once your app was already
instantiated (e.g. app.url_map.host_matching = True), but at that point
the constructor would have already added the static route without host matching
and an associated host, leaving the static route in a broken state.

Fixes #1559.
2017-04-07 16:31:54 +02:00
Grey Li
3d20e9184d Add example for virtualenv integration in cli docs (#2234) 2017-04-07 07:10:43 -07:00
David Lord
a72778fdda Merge pull request #2231 from asilversempirical/patch-1
Update out of date jsonify documentation
2017-04-06 08:31:25 -07:00
asilversempirical
d915c390a2 Update out of date jsonify documentation
https://github.com/pallets/flask/pull/2193 changed the conditions for when jsonify pretty prints, but this comment wasn't updated.
2017-04-06 11:26:01 -04:00
Adam Geitgey
742a143efd Correct imports in file upload example (#2230)
The example code uses `flash` but doesn't import it. So the code as written doesn't work.

This simply adds `flash` to the list of imports in the sample code.
2017-04-04 22:26:40 +02:00
Markus Unterwaditzer
6b38678139 Merge branch '0.12-maintenance' 2017-03-31 18:44:33 +02:00
Markus Unterwaditzer
247a0c906d Revert "Handle BaseExceptions (#2222)"
This reverts commit 1d4448abe3.
2017-03-31 18:44:14 +02:00
Markus Unterwaditzer
0cbee768d3 Bump to dev version 2017-03-31 18:43:52 +02:00
Markus Unterwaditzer
c6a9895dc6 Bump version number to 0.12.1 2017-03-31 18:43:36 +02:00
Markus Unterwaditzer
6b77184efb Prepare for 0.12.1 2017-03-31 18:43:34 +02:00
Markus Unterwaditzer
5b10ba89ce Correct changelog 2017-03-31 18:41:10 +02:00
Markus Unterwaditzer
6af8260d77 Merge branch 'Diggsey-db-handle-baseexceptions' into 0.12-maintenance 2017-03-31 18:40:55 +02:00
Diggory Blake
65cf64e019 Make test more idiomatic 2017-03-31 18:40:46 +02:00
Diggory Blake
965d444e0f Add test and changes 2017-03-31 18:40:46 +02:00
Diggory Blake
d41d0803ef Handle BaseExceptions 2017-03-31 18:40:46 +02:00
Diggory Blake
2774221987 Handle BaseExceptions (#2222)
* Handle BaseExceptions

* Add test and changes

* Make test more idiomatic
2017-03-31 18:07:43 +02:00
David Lord
be67b9d3ba Merge pull request #2217 from edbrannin/patch-1
shorten output when ImportError due to app bug.
2017-03-24 08:59:00 -07:00
Ed Brannin
9c40039620 Fix CLI test for ImportError -> NoAppException 2017-03-21 16:17:09 -04:00
Ed Brannin
9223569767 shorten output when ImportError due to app bug.
Before:
```
C:\dev\tmp>py -2 -m flask run
Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "c:\dev\sourcetree\flask\flask\__main__.py", line 15, in <module>
    main(as_module=True)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 523, in main
    cli.main(args=args, prog_name=name)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 383, in main
    return AppGroup.main(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "C:\Python27\lib\site-packages\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "C:\Python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 433, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 153, in __init__
    self._load_unlocked()
  File "c:\dev\sourcetree\flask\flask\cli.py", line 177, in _load_unlocked
    self._app = rv = self.loader()
  File "c:\dev\sourcetree\flask\flask\cli.py", line 238, in load_app
    rv = locate_app(self.app_import_path)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 91, in locate_app
    __import__(module)
  File "C:\dev\tmp\error.py", line 1, in <module>
    import whatisthisidonteven
ImportError: No module named whatisthisidonteven
```

After:
```
C:\dev\tmp>py -2 -m flask run
Usage: python -m flask run [OPTIONS]

Error: There was an error trying to import the app (error):
Traceback (most recent call last):
  File "c:\dev\sourcetree\flask\flask\cli.py", line 91, in locate_app
    __import__(module)
  File "C:\dev\tmp\error.py", line 1, in <module>
    import whatisthisidonteven
ImportError: No module named whatisthisidonteven```
2017-03-21 15:22:15 -04:00
David Lord
9e84eaa6c2 Merge pull request #2209 from svenstaro/print-stacktrace-on-cli-error
Print a stacktrace on CLI error (closes #2208)
2017-03-16 13:43:01 -07:00
Sven-Hendrik Haase
edd6e3154d Add test to showcase that printing a traceback works 2017-03-16 20:56:12 +01:00
Sven-Hendrik Haase
c53aa3affe Remove useless pass 2017-03-16 14:42:16 +01:00
Sven-Hendrik Haase
ae6617e85d Print a stacktrace on CLI error (closes #2208) 2017-03-16 14:37:58 +01:00
Jan Ferko
7664e605ba Use print function in quickstart (#2204)
Example in URL Building section uses `print` statement
instead of `print` function, which causes syntax error
when example is run on Python 3.
2017-03-13 13:58:24 +01:00
John Bodley
0dae045fe7 Document run() host defaulting to SERVER_NAME 2017-03-11 18:59:34 +01:00
Ben
42dfa1fce3 Fix broken link (#2202) 2017-03-08 20:26:38 +01:00
Hsiaoming Yang
9c5f048ad2 Don't rely on X-Requested-With for pretty print json response (#2193)
* Don't rely on X-Requested-With for pretty print json response

* Fix test cases for pretty print json patch

* Fix gramma error in docs for pretty print json config

* Add changelog for JSONIFY_PRETTYPRINT_REGULAR
2017-03-07 10:09:46 +09:00
Static
3eb41b7309 Fix typos/grammar in docs (#2201) 2017-03-06 14:05:59 +01:00
Elton Law
822697fe1f Close <li> tag in tutorial (#2199)
Change was merged in the example code but wasn't changed in the docs. c54d67adee
2017-03-05 13:07:49 +01:00
Adrian
b780d771ef Fix typo 2017-03-04 22:32:23 +01:00
Grey Li
f04ea7f2ba Add tips for debug config with flask cli (#2196)
* Add tips for debug config with flask cli

`app.debug` and `app.config['DEBUG']` are not compatible with the `flask` script.

* Grammar fix

* Grammar fix
2017-03-04 11:29:04 +01:00
Sebastian Kalinowski
17b4fa9b87 Remove extra HTML tag from fileupload docs (#2141) 2017-02-28 14:05:09 +09:00
Timothy John Perisho Eccleston
aadce6bc34 Fix typo in docs/tutorial/templates.rst (#2186) 2017-02-18 07:41:58 +01:00
Nick Ficano
4b25b483b8 Fix typo in file header (jsonimpl => json) 2017-02-15 17:55:56 +01:00
Jeff Widman
2ad2aadb88 Migrate various docs links to https (#2180)
Also fixed a few outdated links
2017-02-11 10:43:11 +01:00
Jeff Widman
742ea5221d bdist_wheel replaces wheel (#2179)
https://packaging.python.org/distributing/#universal-wheels
2017-02-10 12:19:59 +01:00
Markus Unterwaditzer
4f0ab34559 Remove examples dir again 2017-02-09 18:35:21 +01:00
vojtekb
83d2ba9cf8 py.test => pytest (#2173)
py.test => pytest
2017-02-09 18:34:16 +01:00
Markus Unterwaditzer
3c03860a71 Merge pull request #2175 from swanhtet1992/patch-1
Update 4.4.3 HTTP Methods Example
2017-02-09 15:29:58 +01:00
Swan Htet Aung
8ac70e1719 Update 4.4.3 HTTP Methods Example
Otherwise it produces `ValueError: View function did not return a response`.
2017-02-09 18:01:12 +06:30
Armin Ronacher
02b5eadc43 Convert Flask.run into a noop when run from the CLI 2017-01-29 12:26:52 +01:00
David Lord
7af6c7fa97 add test and changelog for SERVER_NAME app.run default
ref #2152
2017-01-17 14:08:33 -08:00
Raphael Deem
eb6e8e40b2 use SERVER_NAME to set host and port in app.run() (#2152) 2017-01-17 13:22:16 -08:00
Jeff Widman
84e1e61f8e Update docs that request is an object, not a class (#2154)
Cleanup sphinx formatting to show that `request` is an object, not a class. The actual class name is `Request`.

Based on discussion [here](https://github.com/pallets/flask/pull/2151#issuecomment-272699147).
2017-01-17 20:20:07 +01:00
Kim Blomqvist
c31e0ade9e Disable debug when FLASK_DEBUG=False (#2155)
Convert FLASK_DEBUG envvar to lower before test if in tuple
2017-01-17 07:15:51 -08:00
Markus Unterwaditzer
07a0006121 Merge pull request #2131 from wgwz/add-larger-app-ex
Add larger app ex
2017-01-15 05:56:12 +01:00
Dennis Chen
b57c88e154 Fix Request Reference (#2151)
Points flask.Request to appropriate place in the documentation.
2017-01-14 21:58:45 +01:00
David Lord
dfb896128c Merge pull request #2149 from onovy/master
Use SOURCE_DATE_EPOCH for copyright year to make build reproducible
2017-01-13 05:30:22 -08:00
Ondřej Nový
fffd9bb650 Use SOURCE_DATE_EPOCH for copyright year to make build reproducible
Details: https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal
2017-01-13 10:54:55 +01:00
David Lord
7e8d606aa9 Merge pull request #2148 from drewja/master
Added python3.6 support for tests
2017-01-10 10:07:26 -08:00