Commits

Yang Zhang  committed 6f167a5

add DEBUG global variable

  • Participants
  • Parent commits f7620bd

Comments (0)

Files changed (2)

         g.db.close()
 
 
-
+@app.context_processor
+def inject_debug():
+    return dict(DEBUG = app.debug)
 
 @app.route("/")
 def MainPage():

File templates/base.html

             <div class='widget'>
                 <div class='widget_header center'>user information
                 </div>
-                
+
                 <div class='widget_content'>here is something about user information
                 </div>
             </div>
-            
-            
 
-            
+
+
+
         </div>
         !-->
 </div><!--endof row-->
 </div>
 </div>
-    
-    
 
 
 
-    
+
+
+
 
 {%endblock%}
 
         <i class="muted icon-chevron-up icon-2x pull-right icon-border"></i>
     </a>
     <p class='center'>Design and Code by <a href=''><strong>Yang</strong></a></p>
-    
+
 </div>
 
 {%include 'js_template.html'%}
 
 <!-- script-->
-<script type="text/javascript" src="/static/metro-bootstrap/docs/jquery-1.8.0.js"></script>
-<script type="text/javascript" src="/static/metro-bootstrap/docs/bootstrap-dropdown.js"></script>
-<script type="text/javascript" src="/static/metro-bootstrap/docs/bootstrap-tab.js"></script>
-<script type="text/javascript" src="/static/bootstrap-typeahead.js"></script>
-<script type="text/javascript" src="/static/jquery.scrollto.js"></script>
+{%if DEBUG%}
+    <script type="text/javascript" src="/static/metro-bootstrap/docs/jquery-1.8.0.js"></script>
+{%else%}
+    <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.8/jquery.min.js"></script>
+{%endif%}
+    <script type="text/javascript" src="/static/metro-bootstrap/docs/bootstrap-dropdown.js"></script>
+    <script type="text/javascript" src="/static/metro-bootstrap/docs/bootstrap-tab.js"></script>
+    <script type="text/javascript" src="/static/bootstrap-typeahead.js"></script>
+    <script type="text/javascript" src="/static/jquery.scrollto.js"></script>
+    <script type="text/javascript" src="/static/mustache.js"></script>
+    <script type="text/javascript" src="/static/main.js"></script>
 
+{%if not DEBUG%}
+<script type="text/javascript">
 
-<script type="text/javascript" src="/static/mustache.js"></script>
-<script type="text/javascript" src="/static/main.js"></script>
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-33614458-1']);
+  _gaq.push(['_trackPageview']);
 
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
 
-<!--  
+</script>
+{%endif%}
+<!--
 
 <script type="text/javascript" src="/static/metro-bootstrap/docs/bootstrap-tooltip.js"></script>
 <script type="text/javascript" src="/static/metro-bootstrap/docs/bootstrap-alert.js"></script>