Commits

Yang Zhang  committed 0cebe7d

add bootstrap

  • Participants
  • Parent commits 742f366

Comments (0)

Files changed (10)

File projectname/__init__.py

-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
+
+import os
+
+import flask as f
+from flask import Flask
+import flask.ext.assets as fassets
+
+import config.conf as conf
+
+app = Flask(__name__)
+
+app.config.from_object("projectname.config.conf")
+
+assets = fassets.Environment(app)
+assets.versions = 'hash:32'
+
+@app.before_request
+def something_before_request():
+    pass
+
+import controllers

File projectname/config/conf.py

-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
 
 import logging
 import datetime as dt
 JS_DEBUG = False
 PRODUCTION = False
 
-SITE = ""#your site here
+SITENAME = "projectname"#your site here
 SITE_DOMAIN = ""#your site here
 PORT = "5000"
 SECRET_KEY = "secret_keyplzchangeit"

File projectname/controller/__init__.py

-# -*- coding: utf-8 -*-

File projectname/controllers/__init__.py

+# -*- coding: utf-8 -*-
+import frontend

File projectname/controllers/frontend.py

+# -*- coding: utf-8 -*-
+
+from flask import render_template
+
+from projectname import app
+
+@app.route('/')
+def main():
+    return render_template("main.html")

File projectname/static/main.css

Empty file removed.

File projectname/static/main.less

Empty file added.

File projectname/templates/base.html

     <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-
+    <title>{{config.SITENAME}}</title>
+    
+    <link rel="stylesheet/less" type="text/css" href="/static/main.less">
+    <script src="/static/libs/less-1.3.1.min.js" type="text/javascript"></script>
     </head>
-
+        
     <body>
-
-
-
-
+        <div class="container">
+            <div class="row-fluid">
+              <div class="span4"><h1>Left span4</h1></div>
+              <div class="span8"><h1>Right span8</h1></div>
+            </div>
+        </div>
     </body>
 </html>
 

File projectname/templates/main.html

+{%extends "base.html"%}

File runserver.py

+# -*- coding: utf-8 -*-
+
+from projectname import app
+
+
+if(__name__ == "__main__"):
+    app.debug = app.config["DEBUG_MODE"]
+    app.run()