Show More
@@ -0,0 +1,31 b'' | |||
|
1 | #!/bin/sh -e | |
|
2 | ### BEGIN INIT INFO | |
|
3 | # Provides: pylons-manage | |
|
4 | # Required-Start: $all | |
|
5 | # Required-Stop: $all | |
|
6 | # Default-Start: 2 3 4 5 | |
|
7 | # Default-Stop: 0 1 6 | |
|
8 | # Short-Description: starts pylons app | |
|
9 | # Description: starts pylons app | |
|
10 | ### END INIT INFO | |
|
11 | ||
|
12 | project_name=hg_app | |
|
13 | conf_name=development.ini | |
|
14 | project_path=/home/marcink/python_workspace/$project_name | |
|
15 | virt_python=/home/marcink/virt_python | |
|
16 | ||
|
17 | cd $project_path | |
|
18 | case "$1" in | |
|
19 | start) | |
|
20 | $virt_python/bin/paster serve --daemon --pid-file=$project_path/$project_name.pid --log-file=$project_path/$project_name.log $project_path/$conf_name start | |
|
21 | ;; | |
|
22 | stop) | |
|
23 | $virt_python/bin/paster serve --daemon --pid-file=$project_path/$project_name.pid --log-file=$project_path/$project_namete.log $project_path/$conf_name stop | |
|
24 | ;; | |
|
25 | restart) | |
|
26 | $virt_python/bin/paster serve --daemon --pid-file=$project_path/$project_name.pid --log-file=$project_path/$project_name.log $project_path/$conf_name restart | |
|
27 | ;; | |
|
28 | *) | |
|
29 | echo "Usage: $0 {start|stop|restart}" | |
|
30 | exit 1 | |
|
31 | esac No newline at end of file |
@@ -1,18 +1,16 b'' | |||
|
1 | ######################################################################## | |
|
2 | ## | |
|
3 |
|
|
|
4 | ## | |
|
5 | ## The %(here)s variable will be replaced with the parent directory of this file | |
|
1 | ################################################################################ | |
|
2 | ################################################################################ | |
|
3 | # pylons_app - Pylons environment configuration # | |
|
6 | 4 | ## |
|
7 | [exe] | |
|
8 | command = serve | |
|
9 | daemon = false | |
|
10 | user = nobody | |
|
11 | group = nobody | |
|
5 | # The %(here)s variable will be replaced with the parent directory of this file# | |
|
6 | ################################################################################ | |
|
12 | 7 | |
|
13 | 8 | [DEFAULT] |
|
14 | 9 | debug = true |
|
15 | ## Uncomment and replace with the address which should receive any error reports | |
|
10 | ############################################ | |
|
11 | ## Uncomment and replace with the address ## | |
|
12 | ## which should receive any error reports ## | |
|
13 | ############################################ | |
|
16 | 14 | email_to = marcin.kuzminski@etelko.pl |
|
17 | 15 | smtp_server = localhost |
|
18 | 16 | error_email_from = paste_error@localhost |
@@ -20,79 +18,62 b' error_email_from = paste_error@localhost' | |||
|
20 | 18 | [server:main] |
|
21 | 19 | use = egg:Paste#http |
|
22 | 20 | host = 127.0.0.1 |
|
23 |
port = |
|
|
21 | port = 5000 | |
|
24 | 22 | |
|
25 | 23 | [app:main] |
|
26 | 24 | use = egg:pylons_app |
|
27 | 25 | full_stack = true |
|
28 |
static_files = |
|
|
29 | ##default lang | |
|
26 | static_files = true | |
|
30 | 27 | lang=en |
|
31 | ||
|
32 | 28 | cache_dir = %(here)s/data |
|
33 | beaker.session.key = pylons_app | |
|
34 | beaker.session.secret = #@^^F&VWUDCT%@$#WR^@&*IWEKF | |
|
35 | beaker.session.timeout = 3600 | |
|
36 | 29 | |
|
37 | ##auto save the session to not to use .save() | |
|
38 | beaker.session.auto = True | |
|
39 | ||
|
40 | ##true exire at browser close | |
|
41 | #beaker.session.cookie_expires = 3600 | |
|
42 | ||
|
43 | ## If you'd like to fine-tune the individual locations of the cache data dirs | |
|
44 | ## for the Cache data, or the Session saves, un-comment the desired settings | |
|
45 | ## here: | |
|
46 | #beaker.cache.data_dir = %(here)s/data/cache | |
|
47 | #beaker.session.data_dir = %(here)s/data/sessions | |
|
30 | ################################################################################ | |
|
31 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
|
32 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
|
33 | ## execute malicious code after an exception is raised. ## | |
|
34 | ################################################################################ | |
|
35 | #set debug = false | |
|
48 | 36 | |
|
49 | 37 | |
|
50 | ##Type of storage used for the session, current types are | |
|
51 | ##“dbm”, “file”, “memcached”, “database”, and “memory”. | |
|
52 | ##The storage uses the Container API that is also used by the cache system. | |
|
53 | beaker.session.type = memory | |
|
54 | ||
|
55 | ##if db or memcached is used | |
|
56 | ##you have to use | |
|
57 | #beaker.session.url = | |
|
58 | #beaker.session.table_name = | |
|
59 | ||
|
60 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* | |
|
61 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to | |
|
62 | ## execute malicious code after an exception is raised. | |
|
63 | #set debug = false | |
|
64 | ||
|
65 | ##dozer logging | |
|
66 | logview.pylons.templating = #bfb | |
|
67 | logview.sample_app.lib = #aaa | |
|
68 | ||
|
69 | # Logging configuration | |
|
38 | ################################ | |
|
39 | ### LOGGING CONFIGURATION #### | |
|
40 | ################################ | |
|
70 | 41 | [loggers] |
|
71 | keys = root, routes, pylons_app | |
|
42 | keys = root, routes, pylons_app, sqlalchemy | |
|
72 | 43 | |
|
73 | 44 | [handlers] |
|
74 |
keys = console |
|
|
45 | keys = console | |
|
75 | 46 | |
|
76 | 47 | [formatters] |
|
77 | 48 | keys = generic |
|
78 | 49 | |
|
50 | ############# | |
|
79 | 51 | ## LOGGERS ## |
|
52 | ############# | |
|
80 | 53 | [logger_root] |
|
81 |
level = |
|
|
82 |
handlers = console |
|
|
54 | level = INFO | |
|
55 | handlers = console | |
|
83 | 56 | |
|
84 | 57 | [logger_routes] |
|
85 |
level = |
|
|
58 | level = INFO | |
|
86 | 59 | handlers = console |
|
87 | 60 | qualname = routes.middleware |
|
88 | 61 | # "level = DEBUG" logs the route matched and routing variables. |
|
89 | 62 | |
|
90 | 63 | [logger_pylons_app] |
|
91 | 64 | level = DEBUG |
|
92 |
handlers = console |
|
|
65 | handlers = console | |
|
93 | 66 | qualname = pylons_app |
|
94 | 67 | |
|
68 | ||
|
69 | [logger_sqlalchemy] | |
|
70 | level = DEBUG | |
|
71 | handlers = console | |
|
72 | qualname = sqlalchemy.engine | |
|
73 | ||
|
74 | ############## | |
|
95 | 75 | ## HANDLERS ## |
|
76 | ############## | |
|
96 | 77 | |
|
97 | 78 | [handler_console] |
|
98 | 79 | class = StreamHandler |
@@ -100,13 +81,9 b' args = (sys.stderr,)' | |||
|
100 | 81 | level = NOTSET |
|
101 | 82 | formatter = generic |
|
102 | 83 | |
|
103 | [handler_file_handler] | |
|
104 | class = FileHandler | |
|
105 | args = ('./pylons_app.log','a') | |
|
106 | level = NOTSET | |
|
107 | formatter = generic | |
|
108 | ||
|
84 | ################ | |
|
109 | 85 | ## FORMATTERS ## |
|
86 | ################ | |
|
110 | 87 | |
|
111 | 88 | [formatter_generic] |
|
112 | 89 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
@@ -11,9 +11,8 b' push_ssl = false' | |||
|
11 | 11 | contact = marcin.kuzminski@etelko.pl |
|
12 | 12 | allow_archive = gz zip bz2 |
|
13 | 13 | allow_push = * |
|
14 | #style = monoblue | |
|
15 | 14 | style = gitweb |
|
16 |
|
|
|
15 | pygments_style = trac | |
|
17 | 16 | staticurl = /static |
|
18 | 17 | baseurl = / |
|
19 | 18 |
@@ -1,18 +1,16 b'' | |||
|
1 | ######################################################################## | |
|
2 | ## | |
|
3 |
|
|
|
4 | ## | |
|
5 | ## The %(here)s variable will be replaced with the parent directory of this file | |
|
1 | ################################################################################ | |
|
2 | ################################################################################ | |
|
3 | # pylons_app - Pylons environment configuration # | |
|
6 | 4 | ## |
|
7 | [exe] | |
|
8 | command = serve | |
|
9 | daemon = false | |
|
10 | user = nobody | |
|
11 | group = nobody | |
|
5 | # The %(here)s variable will be replaced with the parent directory of this file# | |
|
6 | ################################################################################ | |
|
12 | 7 | |
|
13 | 8 | [DEFAULT] |
|
14 | 9 | debug = true |
|
15 | ## Uncomment and replace with the address which should receive any error reports | |
|
10 | ############################################ | |
|
11 | ## Uncomment and replace with the address ## | |
|
12 | ## which should receive any error reports ## | |
|
13 | ############################################ | |
|
16 | 14 | email_to = marcin.kuzminski@etelko.pl |
|
17 | 15 | smtp_server = localhost |
|
18 | 16 | error_email_from = paste_error@localhost |
@@ -24,77 +22,60 b' port = 8001' | |||
|
24 | 22 | |
|
25 | 23 | [app:main] |
|
26 | 24 | use = egg:pylons_app |
|
27 |
full_stack = |
|
|
28 |
static_files = |
|
|
29 |
|
|
|
25 | full_stack = false | |
|
26 | static_files = true | |
|
27 | #default lang | |
|
30 | 28 | lang=en |
|
31 | 29 | |
|
32 | 30 | cache_dir = %(here)s/data |
|
33 | beaker.session.key = pylons_app | |
|
34 | beaker.session.secret = #@^^F&VWUDCT%@$#WR^@&*IWEKF | |
|
35 | beaker.session.timeout = 3600 | |
|
36 | ||
|
37 | ##auto save the session to not to use .save() | |
|
38 | beaker.session.auto = True | |
|
39 | ||
|
40 | ##true exire at browser close | |
|
41 | #beaker.session.cookie_expires = 3600 | |
|
42 | ||
|
43 | ## If you'd like to fine-tune the individual locations of the cache data dirs | |
|
44 | ## for the Cache data, or the Session saves, un-comment the desired settings | |
|
45 | ## here: | |
|
46 | #beaker.cache.data_dir = %(here)s/data/cache | |
|
47 | #beaker.session.data_dir = %(here)s/data/sessions | |
|
48 | 31 | |
|
49 | 32 | |
|
50 | ##Type of storage used for the session, current types are | |
|
51 | ##“dbm”, “file”, “memcached”, “database”, and “memory”. | |
|
52 | ##The storage uses the Container API that is also used by the cache system. | |
|
53 | beaker.session.type = memory | |
|
54 | ||
|
55 | ##if db or memcached is used | |
|
56 | ##you have to use | |
|
57 | #beaker.session.url = | |
|
58 | #beaker.session.table_name = | |
|
59 | ||
|
60 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* | |
|
61 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to | |
|
62 | ## execute malicious code after an exception is raised. | |
|
33 | ################################################################################ | |
|
34 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
|
35 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
|
36 | ## execute malicious code after an exception is raised. ## | |
|
37 | ################################################################################ | |
|
63 | 38 | set debug = false |
|
64 | 39 | |
|
65 | ##dozer logging | |
|
66 | #logview.sqlalchemy = #faa | |
|
67 | #logview.pylons.templating = #bfb | |
|
68 | #logview.sample_app.lib = #aaa | |
|
69 | ||
|
70 | # Logging configuration | |
|
40 | ################################ | |
|
41 | ### LOGGING CONFIGURATION #### | |
|
42 | ################################ | |
|
71 | 43 | [loggers] |
|
72 | keys = root, routes, pylons_app | |
|
44 | keys = root, routes, pylons_app, sqlalchemy | |
|
73 | 45 | |
|
74 | 46 | [handlers] |
|
75 |
keys = console |
|
|
47 | keys = console | |
|
76 | 48 | |
|
77 | 49 | [formatters] |
|
78 | 50 | keys = generic |
|
79 | 51 | |
|
52 | ############# | |
|
80 | 53 | ## LOGGERS ## |
|
54 | ############# | |
|
81 | 55 | [logger_root] |
|
82 |
level = |
|
|
83 |
handlers = |
|
|
56 | level = INFO | |
|
57 | handlers = console | |
|
84 | 58 | |
|
85 | 59 | [logger_routes] |
|
86 | 60 | level = INFO |
|
87 |
handlers = |
|
|
61 | handlers = console | |
|
88 | 62 | qualname = routes.middleware |
|
89 | 63 | # "level = DEBUG" logs the route matched and routing variables. |
|
90 | 64 | |
|
91 | 65 | [logger_pylons_app] |
|
92 | 66 | level = DEBUG |
|
93 |
handlers = |
|
|
67 | handlers = console | |
|
94 | 68 | qualname = pylons_app |
|
95 | 69 | |
|
96 | 70 | |
|
71 | [logger_sqlalchemy] | |
|
72 | level = DEBUG | |
|
73 | handlers = console | |
|
74 | qualname = sqlalchemy.engine | |
|
75 | ||
|
76 | ############## | |
|
97 | 77 | ## HANDLERS ## |
|
78 | ############## | |
|
98 | 79 | |
|
99 | 80 | [handler_console] |
|
100 | 81 | class = StreamHandler |
@@ -102,13 +83,9 b' args = (sys.stderr,)' | |||
|
102 | 83 | level = NOTSET |
|
103 | 84 | formatter = generic |
|
104 | 85 | |
|
105 | [handler_file_handler] | |
|
106 | class = FileHandler | |
|
107 | args = ('./pylons_app.log','a') | |
|
108 | level = NOTSET | |
|
109 | formatter = generic | |
|
110 | ||
|
86 | ################ | |
|
111 | 87 | ## FORMATTERS ## |
|
88 | ################ | |
|
112 | 89 | |
|
113 | 90 | [formatter_generic] |
|
114 | 91 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
@@ -1,9 +1,11 b'' | |||
|
1 | 1 | """Pylons environment configuration""" |
|
2 | 2 | import logging |
|
3 | 3 | import os |
|
4 | from pylons import config | |
|
4 | ||
|
5 | 5 | from mako.lookup import TemplateLookup |
|
6 | 6 | from pylons.error import handle_mako_error |
|
7 | from pylons import config | |
|
8 | ||
|
7 | 9 | import pylons_app.lib.app_globals as app_globals |
|
8 | 10 | import pylons_app.lib.helpers |
|
9 | 11 | from pylons_app.config.routing import make_map |
@@ -34,11 +36,9 b' def load_environment(global_conf, app_co' | |||
|
34 | 36 | directories = paths['templates'], |
|
35 | 37 | error_handler = handle_mako_error, |
|
36 | 38 | module_directory = os.path.join(app_conf['cache_dir'], 'templates'), |
|
37 |
input_encoding = 'utf-8', |
|
|
38 |
imports = ['from webhelpers.html import escape'] |
|
|
39 | ||
|
40 | # Customize templating options via this variable | |
|
41 | tmpl_options = config['buffet.template_options'] | |
|
39 | input_encoding = 'utf-8', output_encoding = 'utf-8', | |
|
40 | imports = ['from webhelpers.html import escape'], | |
|
41 | default_filters = ['escape']) | |
|
42 | 42 | |
|
43 | 43 | # CONFIGURATION OPTIONS HERE (note: all config options will override |
|
44 | 44 | # any Pylons config options) |
@@ -8,10 +8,11 b' from pylons import config' | |||
|
8 | 8 | from pylons.middleware import ErrorHandler, StatusCodeRedirect |
|
9 | 9 | from pylons.wsgiapp import PylonsApp |
|
10 | 10 | from routes.middleware import RoutesMiddleware |
|
11 | ||
|
12 | 11 | from pylons_app.config.environment import load_environment |
|
13 | 12 | |
|
14 | def make_app(global_conf, full_stack = True, static_files = True, **app_conf): | |
|
13 | ||
|
14 | ||
|
15 | def make_app(global_conf, full_stack = True, **app_conf): | |
|
15 | 16 | """Create a Pylons WSGI application and return it |
|
16 | 17 | |
|
17 | 18 | ``global_conf`` |
@@ -19,14 +20,10 b' def make_app(global_conf, full_stack = T' | |||
|
19 | 20 | the [DEFAULT] section of the Paste ini file. |
|
20 | 21 | |
|
21 | 22 | ``full_stack`` |
|
22 |
Whether this application provides a full WSGI stack (by |
|
|
23 |
meaning it handles its own exceptions and errors). |
|
|
24 |
full_stack when this application is "managed" by |
|
|
25 | middleware. | |
|
26 | ||
|
27 | ``static_files`` | |
|
28 | Whether this application serves its own static files; disable | |
|
29 | when another web server is responsible for serving them. | |
|
23 | Whether or not this application provides a full WSGI stack (by | |
|
24 | default, meaning it handles its own exceptions and errors). | |
|
25 | Disable full_stack when this application is "managed" by | |
|
26 | another WSGI middleware. | |
|
30 | 27 | |
|
31 | 28 | ``app_conf`` |
|
32 | 29 | The application's local configuration. Normally specified in |
@@ -40,12 +37,10 b' def make_app(global_conf, full_stack = T' | |||
|
40 | 37 | # The Pylons WSGI app |
|
41 | 38 | app = PylonsApp() |
|
42 | 39 | |
|
40 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) | |
|
41 | ||
|
43 | 42 | # Routing/Session/Cache Middleware |
|
44 | 43 | app = RoutesMiddleware(app, config['routes.map']) |
|
45 | app = SessionMiddleware(app, config) | |
|
46 | app = CacheMiddleware(app, config) | |
|
47 | ||
|
48 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) | |
|
49 | 44 | |
|
50 | 45 | if asbool(full_stack): |
|
51 | 46 | # Handle Python exceptions |
@@ -61,14 +56,9 b' def make_app(global_conf, full_stack = T' | |||
|
61 | 56 | # Establish the Registry for this application |
|
62 | 57 | app = RegistryManager(app) |
|
63 | 58 | |
|
64 | if asbool(static_files): | |
|
65 | # Serve static files | |
|
59 | # Static files (If running in production, and Apache or another web | |
|
60 | # server is handling this static content, remove the following 3 lines) | |
|
66 | 61 |
|
|
67 | 62 |
|
|
63 | return app | |
|
68 | 64 | |
|
69 | #dozer debug | |
|
70 | if asbool(config['debug']): | |
|
71 | from dozer import Logview | |
|
72 | app = Logview(app, config) | |
|
73 | ||
|
74 | return app |
@@ -20,7 +20,7 b' class HgController(BaseController):' | |||
|
20 | 20 | return g.hgapp(request.environ, self.start_response) |
|
21 | 21 | |
|
22 | 22 | def add_repo(self, new_repo): |
|
23 | tmpl = ''' | |
|
23 | tmpl = u''' | |
|
24 | 24 | <html> |
|
25 | 25 | <body> |
|
26 | 26 | %(msg)s%(new_repo)s!<br \> |
@@ -43,8 +43,8 b' class HgController(BaseController):' | |||
|
43 | 43 | return [tmpl % ({'new_repo':new_repo, 'msg':'added repo: '})] |
|
44 | 44 | |
|
45 | 45 | def _check_repo(self, repo_name): |
|
46 | p = os.path.dirname(__file__) | |
|
47 |
config_path = os.path.join(p, ' |
|
|
46 | p = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) | |
|
47 | config_path = os.path.join(p, 'hgwebdir.config') | |
|
48 | 48 | |
|
49 | 49 | cp = ConfigParser() |
|
50 | 50 |
General Comments 0
You need to be logged in to leave comments.
Login now