Permalink
Browse files

V0.2 Minification + App compilation directly from appadmin interface …

…(on state tab)
  • Loading branch information...
1 parent efa043b commit 7219df03c61aa8dd6674d9978162644d9d90083d @Unitech committed Apr 29, 2011
Showing with 229 additions and 288,925 deletions.
  1. +27 −24 README
  2. +28 −1 controllers/appadmin.py
  3. +10 −18 databases/c8b669d15150d7109e5f7ab36744a5b7_auth_user.table
  4. +11 −13 databases/sql.log
  5. BIN databases/storage.sqlite
  6. +0 −13,106 errors/127.0.0.1.2011-04-28.23-10-10.3d1ffe4b-8c31-425a-8167-a530fc86b61a
  7. +0 −13,104 errors/127.0.0.1.2011-04-28.23-10-23.bff21b99-4e13-4f88-a1d3-06ab9af30b24
  8. +0 −13,104 errors/127.0.0.1.2011-04-28.23-11-44.21924c4d-646a-472f-a3be-2e061ea25398
  9. +0 −13,104 errors/127.0.0.1.2011-04-28.23-11-53.22bbb993-b4ff-4183-bb73-68fa20dad5fc
  10. +0 −13,104 errors/127.0.0.1.2011-04-28.23-12-49.b040d4b6-e3d5-4da4-a9c0-48745aabebab
  11. +0 −13,008 errors/127.0.0.1.2011-04-28.23-13-17.016ecc9e-204a-4078-b2d4-0e8d7aa13a93
  12. +0 −13,080 errors/127.0.0.1.2011-04-28.23-14-10.89d33d84-bf52-4e25-a74c-0b90e70a74f5
  13. +0 −13,078 errors/127.0.0.1.2011-04-28.23-14-23.dfb09a1c-f158-4c8a-8aa1-29070afadce3
  14. +0 −13,080 errors/127.0.0.1.2011-04-28.23-16-06.a473e7c9-8026-4342-8e81-e9c0f2d92283
  15. +0 −13,125 errors/127.0.0.1.2011-04-28.23-19-20.dcd7c189-70ae-424b-961f-dabc5294a8e3
  16. +0 −13,125 errors/127.0.0.1.2011-04-28.23-19-37.55f0b6b2-89f2-4991-bc6c-47f21ec51aac
  17. +0 −13,125 errors/127.0.0.1.2011-04-28.23-20-00.83a49b71-e01c-4060-94cd-3b2ad75a986f
  18. +0 −13,105 errors/127.0.0.1.2011-04-28.23-20-21.4646da0d-8466-4259-81ec-f407f4a0481c
  19. +0 −13,105 errors/127.0.0.1.2011-04-28.23-20-38.06d3989c-9601-49d9-8dad-078dbea237f7
  20. +0 −13,105 errors/127.0.0.1.2011-04-28.23-20-48.9e31f5c9-b506-41e7-ba94-7387ff088cfb
  21. +0 −13,125 errors/127.0.0.1.2011-04-28.23-21-32.5fc28cb9-8202-49ee-b6c4-f82911019530
  22. +0 −13,125 errors/127.0.0.1.2011-04-28.23-21-43.5795a520-cb99-4add-b7f5-1453c1a515cd
  23. +0 −13,125 errors/127.0.0.1.2011-04-28.23-22-02.8cf35674-789c-4099-9ae9-d63494abed12
  24. +0 −13,164 errors/127.0.0.1.2011-04-28.23-35-06.39525ca5-ea00-40d3-a6b5-082d80889b74
  25. +0 −13,101 errors/127.0.0.1.2011-04-28.23-35-22.68d35663-7155-47c6-afa0-c5246ca5c2be
  26. +0 −13,101 errors/127.0.0.1.2011-04-28.23-35-43.b22e1df2-045b-42fc-b9bb-ab5bb2dd701c
  27. +0 −13,106 errors/127.0.0.1.2011-04-28.23-37-50.6ea5a929-a773-436f-b631-c42604260df1
  28. +4 −2 models/db.py
  29. +23 −0 models/extra.py
  30. +0 −53 models/minification.py
  31. +12 −6 modules/pack.py
  32. BIN modules/pack.pyc
  33. +4 −2 private/app.log
  34. +21 −11 private/app.log.1
  35. +1 −11 private/app.log.2
  36. +0 −308 static/css/shamebook.css
  37. +0 −39 views/admin/approve.html
  38. +0 −5 views/admin/index.html
  39. +25 −1 views/appadmin.html
  40. +0 −1 views/inc_files.comp
  41. +61 −13 views/layouts/admin_layout.html
  42. +2 −10 views/layouts/layout.html
  43. +0 −22 views/tmp/generic.html
  44. +0 −15 views/tmp/generic.json
  45. +0 −30 views/tmp/generic.load
  46. BIN views/tmp/generic.pdf
  47. +0 −20 views/tmp/generic.rss
  48. +0 −15 views/tmp/generic.xml
View
51 README
@@ -1,37 +1,40 @@
-#
-# Web2Py Template
-#
-# Including CSS/JS Minification, logger and other things
-#
++------------ Web2Py Template -----------+
-### Add JS and CSS files on models/minification.py.
+This Web2Py application template include :
-Actually there are :
++++++++++++++ CSS/JS combination/minification + App compilation directly on 'appadmin'
+
+1# Include all your JS and CSS files in models/extra.py
js_files = [
URL('static', 'js/jquery-1.5.2.js'),
- URL('static', 'js/main.js')
+ URL('static', 'js/main.js'),
+ URL('static', 'js/shit.js')
]
css_files = [
URL('static', 'css/base.css')
]
-An example of working inclusion is in views/layouts/layout.html :
-
- {{# Js files are included from db/minification.py }}
- {{for _item in js_files or []:}}
- <script src="{{=_item}}"></script>
- {{pass}}
-
- {{# Css files}}
- {{for _item in css_files:}}
- <link rel="stylesheet" href="{{=_item}}">
- {{pass}}
-
-
-### To differenciate a production environ there is an environ variable to set
-
-export PRODUCTION='True'
+2# Then in the view include
+ {{include 'layouts/js_css_include_from_extra.html'}}
+
+
++++++++++++++ A new tree organization
+
+├── models
+│   ├── db_conf.py // Configuration Mail + Auth
+│   ├── db.py // Distinction between Prod or not (disbling migration & co)
+│   ├── db_tables.py // DB models declaration
+│   └── extra.py // File to include (JS and CSS)
+└── views
+ ├── appadmin.html
+ ├── default
+ │   └── index.html
+ ├── __init__.py
+ └── layouts
+ ├── admin_layout.html
+ ├── layout.html
+ └── web2py_ajax.htm
View
@@ -11,6 +11,13 @@
import gluon.contenttype
import gluon.fileutils
+
+from gluon.admin import *
+from gluon.fileutils import abspath
+from glob import glob
+import shutil
+import platform
+
# ## critical --- make a copy of the environment
global_env = copy.copy(globals())
@@ -287,8 +294,28 @@ def update():
# ###########################################################
+from gluon.compileapp import compile_application, remove_compiled_application
+
def state():
- return dict()
+ form = FORM(
+ P(TAG.BUTTON("Switch to production ?", _type="submit", _name="prod", _value="prod")),
+ P(TAG.BUTTON("Switch to development ?", _type="submit", _name="dev", _value="dev"))
+ )
+ if form.accepts(request.vars, session):
+ if request.vars.prod:
+ os.environ['PRODUCTION'] = 'True'
+ global css_files
+ global js_files
+ compress = local_import('pack', reload=True)
+ compress.process_css(css_files, request.folder, 'min.css')
+ compress.process_js(js_files, request.folder, 'min.js')
+ c = app_compile(request.application, request)
+ if request.vars.dev:
+ os.environ['PRODUCTION'] = ''
+ remove_compiled_application(apath(request.application, r=request))
+
+ redirect(URL(r=request))
+ return dict(form=form)
def ccache():
form = FORM(
@@ -1,38 +1,30 @@
(dp1
-S'username'
+S'first_name'
p2
S'CHAR(128)'
p3
-sS'first_name'
+sS'last_name'
p4
-S'CHAR(512)'
+S'CHAR(128)'
p5
-sS'last_name'
+sS'email'
p6
S'CHAR(512)'
p7
-sS'registration_id'
+sS'reset_password_key'
p8
S'CHAR(512)'
p9
-sS'email'
+sS'password'
p10
-S'CHAR(128) UNIQUE'
+S'CHAR(512)'
p11
-sS'reset_password_key'
+sS'registration_key'
p12
S'CHAR(512)'
p13
-sS'password'
-p14
-S'CHAR(512)'
-p15
-sS'registration_key'
-p16
-S'CHAR(512)'
-p17
sS'id'
-p18
+p14
S'INTEGER PRIMARY KEY AUTOINCREMENT'
-p19
+p15
s.
View
@@ -1,31 +1,29 @@
-timestamp: 2011-04-28T17:19:26.530050
+timestamp: 2011-04-29T14:08:21.572181
CREATE TABLE auth_user(
id INTEGER PRIMARY KEY AUTOINCREMENT,
- username CHAR(128),
- email CHAR(128) UNIQUE,
- first_name CHAR(512),
- last_name CHAR(512),
+ first_name CHAR(128),
+ last_name CHAR(128),
+ email CHAR(512),
password CHAR(512),
registration_key CHAR(512),
- reset_password_key CHAR(512),
- registration_id CHAR(512)
+ reset_password_key CHAR(512)
);
success!
-timestamp: 2011-04-28T17:19:26.536746
+timestamp: 2011-04-29T14:08:21.588977
CREATE TABLE auth_group(
id INTEGER PRIMARY KEY AUTOINCREMENT,
role CHAR(512),
description TEXT
);
success!
-timestamp: 2011-04-28T17:19:26.539330
+timestamp: 2011-04-29T14:08:21.590916
CREATE TABLE auth_membership(
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES auth_user(id) ON DELETE CASCADE,
group_id INTEGER REFERENCES auth_group(id) ON DELETE CASCADE
);
success!
-timestamp: 2011-04-28T17:19:26.541494
+timestamp: 2011-04-29T14:08:21.593043
CREATE TABLE auth_permission(
id INTEGER PRIMARY KEY AUTOINCREMENT,
group_id INTEGER REFERENCES auth_group(id) ON DELETE CASCADE,
@@ -34,7 +32,7 @@ CREATE TABLE auth_permission(
record_id INTEGER
);
success!
-timestamp: 2011-04-28T17:19:26.547203
+timestamp: 2011-04-29T14:08:21.595209
CREATE TABLE auth_event(
id INTEGER PRIMARY KEY AUTOINCREMENT,
time_stamp TIMESTAMP,
@@ -44,7 +42,7 @@ CREATE TABLE auth_event(
description TEXT
);
success!
-timestamp: 2011-04-28T17:19:26.555055
+timestamp: 2011-04-29T14:08:21.600177
CREATE TABLE articles(
id INTEGER PRIMARY KEY AUTOINCREMENT,
title CHAR(128),
@@ -59,7 +57,7 @@ CREATE TABLE articles(
user_name CHAR(512)
);
success!
-timestamp: 2011-04-28T17:19:26.558177
+timestamp: 2011-04-29T14:08:21.616785
CREATE TABLE comments(
id INTEGER PRIMARY KEY AUTOINCREMENT,
title CHAR(128),
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 7219df0

Please sign in to comment.