ipython Python default Feb 19 2014 13 47 28 Type copyright credits or

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
➜ ~
➜ ~
➜ ~
➜ ~
➜ ~ ipython
Python 2.7.5 (default, Feb 19 2014, 13:47:28)
Type "copyright", "credits" or "license" for more information.
IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from flask import Flask, g, request, current_app
In [2]:
Do you really want to exit ([y]/n)?
➜ ~ c

➜ ~ ipython
Python 2.7.5 (default, Feb 19 2014, 13:47:28)
Type "copyright", "credits" or "license" for more information.
IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from flask import Flask, g, request, current_app
In [2]: app1 = Flask('first')
In [3]: app2 = Flask('second')
In [4]: g
Out[4]: <LocalProxy unbound>
In [5]: request
Out[5]: <LocalProxy unbound>
In [6]: current_app
Out[6]: <LocalProxy unbound>
In [7]: app2.ap
app2.app_context app2.app_ctx_globals_class
In [7]: app2.app_c
app2.app_context app2.app_ctx_globals_class
In [7]: ctx2 = app2.app_context()
In [8]: ctx1 = app1.app_context()
In [9]: g
Out[9]: <LocalProxy unbound>
In [10]: request
Out[10]: <LocalProxy unbound>
In [11]: current_app
Out[11]: <LocalProxy unbound>
In [12]: ctx1.push()
In [13]: current_app
Out[13]: <Flask 'first'>
In [14]: request
Out[14]: <LocalProxy unbound>
In [15]: g
Out[15]: <flask.g of 'first'>
In [16]: g.first = 1
In [17]: