##// END OF EJS Templates
#37 fixed json imports for python2.5...
marcink -
r592:0a48c1ec default
parent child Browse files
Show More
@@ -1,160 +1,171 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # rhodecode - Pylons environment configuration #
4 4 # #
5 5 # The %(here)s variable will be replaced with the parent directory of this file#
6 6 ################################################################################
7 7
8 8 [DEFAULT]
9 9 debug = true
10 10 ################################################################################
11 11 ## Uncomment and replace with the address which should receive ##
12 12 ## any error reports after application crash ##
13 13 ## Additionally those settings will be used by rhodecode mailing system ##
14 14 ################################################################################
15 15 #email_to = admin@localhost
16 16 #error_email_from = paste_error@localhost
17 17 #app_email_from = rhodecode-noreply@localhost
18 18 #error_message =
19 19
20 20 #smtp_server = mail.server.com
21 21 #smtp_username =
22 22 #smtp_password =
23 23 #smtp_port =
24 24 #smtp_use_tls =
25 25
26 26 [server:main]
27 27 ##nr of threads to spawn
28 28 threadpool_workers = 5
29 29
30 30 ##max request before
31 31 threadpool_max_requests = 6
32 32
33 33 ##option to use threads of process
34 34 use_threadpool = false
35 35
36 36 use = egg:Paste#http
37 37 host = 127.0.0.1
38 38 port = 5000
39 39
40 40 [app:main]
41 41 use = egg:rhodecode
42 42 full_stack = true
43 43 static_files = true
44 44 lang=en
45 45 cache_dir = %(here)s/data
46 46
47 47 ####################################
48 48 ### BEAKER CACHE ####
49 49 ####################################
50 beaker.cache.data_dir=/%(here)s/data/cache/data
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
52 beaker.cache.regions=super_short_term,short_term,long_term
53 beaker.cache.long_term.type=memory
54 beaker.cache.long_term.expire=36000
55 beaker.cache.short_term.type=memory
56 beaker.cache.short_term.expire=60
57 beaker.cache.super_short_term.type=memory
58 beaker.cache.super_short_term.expire=10
50 beaker.cache.data_dir=/%(here)s/data/cache/data
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
52 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
53 beaker.cache.long_term.type=memory
54 beaker.cache.long_term.expire=36000
55
56 beaker.cache.short_term.type=memory
57 beaker.cache.short_term.expire=60
58
59 beaker.cache.super_short_term.type=memory
60 beaker.cache.super_short_term.expire=10
61
62 beaker.cache.sql_cache_short.type=memory
63 beaker.cache.sql_cache_short.expire=5
64
65 beaker.cache.sql_cache_med.type=memory
66 beaker.cache.sql_cache_med.expire=360
67
68 beaker.cache.sql_cache_long.type=file
69 beaker.cache.sql_cache_long.expire=3600
59 70
60 71 ####################################
61 72 ### BEAKER SESSION ####
62 73 ####################################
63 74 ## Type of storage used for the session, current types are
64 75 ## "dbm", "file", "memcached", "database", and "memory".
65 76 ## The storage uses the Container API
66 77 ##that is also used by the cache system.
67 78 beaker.session.type = file
68 79
69 80 beaker.session.key = rhodecode
70 81 beaker.session.secret = g654dcno0-9873jhgfreyu
71 82 beaker.session.timeout = 36000
72 83
73 84 ##auto save the session to not to use .save()
74 85 beaker.session.auto = False
75 86
76 87 ##true exire at browser close
77 88 #beaker.session.cookie_expires = 3600
78 89
79 90
80 91 ################################################################################
81 92 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
82 93 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
83 94 ## execute malicious code after an exception is raised. ##
84 95 ################################################################################
85 96 #set debug = false
86 97
87 98 ##################################
88 99 ### LOGVIEW CONFIG ###
89 100 ##################################
90 101 logview.sqlalchemy = #faa
91 102 logview.pylons.templating = #bfb
92 103 logview.pylons.util = #eee
93 104
94 105 #########################################################
95 106 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
96 107 #########################################################
97 108 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
98 109 #sqlalchemy.db1.echo = False
99 110 #sqlalchemy.db1.pool_recycle = 3600
100 111 sqlalchemy.convert_unicode = true
101 112
102 113 ################################
103 114 ### LOGGING CONFIGURATION ####
104 115 ################################
105 116 [loggers]
106 117 keys = root, routes, rhodecode, sqlalchemy
107 118
108 119 [handlers]
109 120 keys = console
110 121
111 122 [formatters]
112 123 keys = generic,color_formatter
113 124
114 125 #############
115 126 ## LOGGERS ##
116 127 #############
117 128 [logger_root]
118 129 level = NOTSET
119 130 handlers = console
120 131
121 132 [logger_routes]
122 133 level = DEBUG
123 134 handlers = console
124 135 qualname = routes.middleware
125 136 # "level = DEBUG" logs the route matched and routing variables.
126 137
127 138 [logger_rhodecode]
128 139 level = DEBUG
129 140 handlers = console
130 141 qualname = rhodecode
131 142 propagate = 0
132 143
133 144 [logger_sqlalchemy]
134 145 level = ERROR
135 146 handlers = console
136 147 qualname = sqlalchemy.engine
137 148 propagate = 0
138 149
139 150 ##############
140 151 ## HANDLERS ##
141 152 ##############
142 153
143 154 [handler_console]
144 155 class = StreamHandler
145 156 args = (sys.stderr,)
146 157 level = NOTSET
147 158 formatter = color_formatter
148 159
149 160 ################
150 161 ## FORMATTERS ##
151 162 ################
152 163
153 164 [formatter_generic]
154 165 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
155 166 datefmt = %Y-%m-%d %H:%M:%S
156 167
157 168 [formatter_color_formatter]
158 169 class=rhodecode.lib.colored_formatter.ColorFormatter
159 170 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
160 171 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
@@ -1,15 +1,20 b''
1 1 .. _changelog:
2 2
3 3 Changelog
4 4 =========
5 5
6 1.0.0rc4 (**2010-10-12**)
6 7
7 1.0.0rc3 (**tip**)
8 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
9 - removed cache_manager settings from sqlalchemy meta
10 - added sqlalchemy cache settings to ini files
11
12 1.0.0rc3 (**2010-10-11**)
8 13
9 14 - fixed i18n during installation.
10 15
11 1.0.0rc2 (**tip**)
16 1.0.0rc2 (**2010-10-11**)
12 17
13 18 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
14 19 occure. After vcs is fixed it'll be put back again.
15 20 - templating/css rewrites, optimized css.
@@ -1,132 +1,129 b''
1 1 .. _setup:
2 2
3 3 Setup
4 4 =====
5 5
6 6
7 7 Setting up the application
8 8 --------------------------
9 9
10 10 ::
11 11
12 12 paster make-config RhodeCode production.ini
13 13
14 14 - This will create `production.ini` config inside the directory
15 15 this config contain various settings for rhodecode, e.g port, email settings
16 16 static files, cache and logging.
17 17
18 18 ::
19 19
20 20 paster setup-app production.ini`
21 21
22 22 - This command will create all needed tables and an admin account.
23 23 When asked for a path You can either use a new location of one with already
24 24 existing ones. RhodeCode will simply add all new found repositories to
25 25 it's database. Also make sure You specify correct path to repositories.
26 26 - Remember that the given path for mercurial_ repositories must be write
27 27 accessible for the application. It's very important since RhodeCode web interface
28 28 will work even without such an access but, when trying to do a push it'll
29 eventually faile with permission denied errors.
29 eventually fail with permission denied errors.
30 30 - Run
31 31
32 32 ::
33 33
34 34 paster serve production.ini
35 35
36 36 - This command runs the rhodecode server the app should be available at the
37 37 127.0.0.1:5000. This ip and port is configurable via the production.ini
38 file created in previos step
38 file created in previous step
39 39 - Use admin account you created to login.
40 40 - Default permissions on each repository is read, and owner is admin. So
41 remember to update these.
42
43 - All needed configs are inside rhodecode sources ie. celeryconfig.py,
44 development.ini, production.ini You can configure the email, ports, loggers,
45 workers from there.
41 remember to update these if needed.
46 42
43
47 44 Setting up Whoosh
48 45 -----------------
49 46
50 47 - For full text search You can either put crontab entry for
51 48
52 49 ::
53 50
54 python /var/www/rhodecode/rhodecode/lib/indexers/daemon.py incremental <put_here_path_to_repos>
51 python /var/www/rhodecode/<rhodecode_installation_path>/lib/indexers/daemon.py incremental <put_here_path_to_repos>
55 52
56 53 When using incremental mode whoosh will check last modification date of each file
57 54 and add it to reindex if newer file is available. Also indexing daemon checks
58 55 for removed files and removes them from index. Sometime You might want to rebuild
59 56 index from scrach, in admin pannel You can check `build from scratch` flag
60 57 and in standalone daemon You can pass `full` instead on incremental to build
61 58 remove previos index and build new one.
62 59
63 60 Nginx virtual host example
64 61 --------------------------
65 62
66 63 Sample config for nginx::
67 64
68 65 server {
69 66 listen 80;
70 67 server_name hg.myserver.com;
71 68 access_log /var/log/nginx/rhodecode.access.log;
72 error_log /var/log/nginx/rhodecode.error.log;
69 error_log /var/log/nginx/rhodecode.error.log;
73 70 location / {
74 71 root /var/www/rhodecode/rhodecode/public/;
75 72 if (!-f $request_filename){
76 73 proxy_pass http://127.0.0.1:5000;
77 74 }
78 75 #this is important for https !!!
79 76 proxy_set_header X-Url-Scheme $scheme;
80 77 include /etc/nginx/proxy.conf;
81 78 }
82 79 }
83 80
84 Here's the proxy.conf. It's tunned so it'll not timeout on long
81 Here's the proxy.conf. It's tuned so it'll not timeout on long
85 82 pushes and also on large pushes::
86 83
87 84 proxy_redirect off;
88 85 proxy_set_header Host $host;
89 86 proxy_set_header X-Host $http_host;
90 87 proxy_set_header X-Real-IP $remote_addr;
91 88 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
92 89 proxy_set_header Proxy-host $proxy_host;
93 90 client_max_body_size 400m;
94 91 client_body_buffer_size 128k;
95 92 proxy_buffering off;
96 93 proxy_connect_timeout 3600;
97 94 proxy_send_timeout 3600;
98 95 proxy_read_timeout 3600;
99 96 proxy_buffer_size 8k;
100 97 proxy_buffers 8 32k;
101 98 proxy_busy_buffers_size 64k;
102 99 proxy_temp_file_write_size 64k;
103 100
104 101 Also when using root path with nginx You might set the static files to false
105 102 in production.ini file::
106 103
107 104 [app:main]
108 105 use = egg:rhodecode
109 106 full_stack = true
110 107 static_files = false
111 108 lang=en
112 109 cache_dir = %(here)s/data
113 110
114 To not have the statics served by the application.
111 To not have the statics served by the application. And improve speed.
115 112
116 113
117 114 Other configuration files
118 115 -------------------------
119 116
120 117 Some extra configuration files and examples can be found here:
121 118 http://hg.python-works.com/rhodecode/files/tip/init.d
122 119
123 120 and also an celeryconfig file can be use from here:
124 121 http://hg.python-works.com/rhodecode/files/tip/celeryconfig.py
125 122
126 123
127 124
128 125 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
129 126 .. _python: http://www.python.org/
130 127 .. _mercurial: http://mercurial.selenic.com/
131 128 .. _celery: http://celeryproject.org/
132 129 .. _rabbitmq: http://www.rabbitmq.com/ No newline at end of file
@@ -1,160 +1,171 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # rhodecode - Pylons environment configuration #
4 4 # #
5 5 # The %(here)s variable will be replaced with the parent directory of this file#
6 6 ################################################################################
7 7
8 8 [DEFAULT]
9 9 debug = true
10 10 ################################################################################
11 11 ## Uncomment and replace with the address which should receive ##
12 12 ## any error reports after application crash ##
13 13 ## Additionally those settings will be used by rhodecode mailing system ##
14 14 ################################################################################
15 15 #email_to = admin@localhost
16 16 #error_email_from = paste_error@localhost
17 17 #app_email_from = rhodecode-noreply@localhost
18 18 #error_message =
19 19
20 20 #smtp_server = mail.server.com
21 21 #smtp_username =
22 22 #smtp_password =
23 23 #smtp_port =
24 24 #smtp_use_tls = false
25 25
26 26 [server:main]
27 27 ##nr of threads to spawn
28 28 threadpool_workers = 5
29 29
30 30 ##max request before thread respawn
31 31 threadpool_max_requests = 2
32 32
33 33 ##option to use threads of process
34 34 use_threadpool = true
35 35
36 36 use = egg:Paste#http
37 37 host = 127.0.0.1
38 38 port = 8001
39 39
40 40 [app:main]
41 41 use = egg:rhodecode
42 42 full_stack = true
43 43 static_files = false
44 44 lang=en
45 45 cache_dir = %(here)s/data
46 46
47 47 ####################################
48 48 ### BEAKER CACHE ####
49 49 ####################################
50 beaker.cache.data_dir=/%(here)s/data/cache/data
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
52 beaker.cache.regions=super_short_term,short_term,long_term
53 beaker.cache.long_term.type=memory
54 beaker.cache.long_term.expire=36000
55 beaker.cache.short_term.type=memory
56 beaker.cache.short_term.expire=60
57 beaker.cache.super_short_term.type=memory
58 beaker.cache.super_short_term.expire=10
50 beaker.cache.data_dir=/%(here)s/data/cache/data
51 beaker.cache.lock_dir=/%(here)s/data/cache/lock
52 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
53 beaker.cache.long_term.type=memory
54 beaker.cache.long_term.expire=36000
55
56 beaker.cache.short_term.type=memory
57 beaker.cache.short_term.expire=60
58
59 beaker.cache.super_short_term.type=memory
60 beaker.cache.super_short_term.expire=10
61
62 beaker.cache.sql_cache_short.type=memory
63 beaker.cache.sql_cache_short.expire=5
64
65 beaker.cache.sql_cache_med.type=memory
66 beaker.cache.sql_cache_med.expire=360
67
68 beaker.cache.sql_cache_long.type=file
69 beaker.cache.sql_cache_long.expire=3600
59 70
60 71 ####################################
61 72 ### BEAKER SESSION ####
62 73 ####################################
63 74 ## Type of storage used for the session, current types are
64 ## dbm, file, memcached, database, and memory.
75 ## "dbm", "file", "memcached", "database", and "memory".
65 76 ## The storage uses the Container API
66 77 ##that is also used by the cache system.
67 78 beaker.session.type = file
68 79
69 80 beaker.session.key = rhodecode
70 81 beaker.session.secret = g654dcno0-9873jhgfreyu
71 82 beaker.session.timeout = 36000
72 83
73 84 ##auto save the session to not to use .save()
74 85 beaker.session.auto = False
75 86
76 87 ##true exire at browser close
77 88 #beaker.session.cookie_expires = 3600
78 89
79 90
80 91 ################################################################################
81 92 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
82 93 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
83 94 ## execute malicious code after an exception is raised. ##
84 95 ################################################################################
85 96 set debug = false
86 97
87 98 ##################################
88 99 ### LOGVIEW CONFIG ###
89 100 ##################################
90 101 logview.sqlalchemy = #faa
91 102 logview.pylons.templating = #bfb
92 103 logview.pylons.util = #eee
93 104
94 105 #########################################################
95 106 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
96 107 #########################################################
97 108 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
98 109 #sqlalchemy.db1.echo = False
99 110 #sqlalchemy.db1.pool_recycle = 3600
100 111 sqlalchemy.convert_unicode = true
101 112
102 113 ################################
103 114 ### LOGGING CONFIGURATION ####
104 115 ################################
105 116 [loggers]
106 117 keys = root, routes, rhodecode, sqlalchemy
107 118
108 119 [handlers]
109 120 keys = console
110 121
111 122 [formatters]
112 123 keys = generic,color_formatter
113 124
114 125 #############
115 126 ## LOGGERS ##
116 127 #############
117 128 [logger_root]
118 129 level = INFO
119 130 handlers = console
120 131
121 132 [logger_routes]
122 133 level = INFO
123 134 handlers = console
124 135 qualname = routes.middleware
125 136 # "level = DEBUG" logs the route matched and routing variables.
126 137
127 138 [logger_rhodecode]
128 139 level = DEBUG
129 140 handlers = console
130 141 qualname = rhodecode
131 142 propagate = 0
132 143
133 144 [logger_sqlalchemy]
134 145 level = ERROR
135 146 handlers = console
136 147 qualname = sqlalchemy.engine
137 148 propagate = 0
138 149
139 150 ##############
140 151 ## HANDLERS ##
141 152 ##############
142 153
143 154 [handler_console]
144 155 class = StreamHandler
145 156 args = (sys.stderr,)
146 157 level = NOTSET
147 158 formatter = color_formatter
148 159
149 160 ################
150 161 ## FORMATTERS ##
151 162 ################
152 163
153 164 [formatter_generic]
154 165 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
155 166 datefmt = %Y-%m-%d %H:%M:%S
156 167
157 168 [formatter_color_formatter]
158 169 class=rhodecode.lib.colored_formatter.ColorFormatter
159 170 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
160 171 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
@@ -1,35 +1,35 b''
1 1 #!/usr/bin/env python
2 2 # encoding: utf-8
3 3 # RhodeCode, a web based repository management based on pylons
4 4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 5 #
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; version 2
9 9 # of the License or (at your opinion) any later version of the license.
10 10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19 # MA 02110-1301, USA.
20 20 """
21 21 Created on April 9, 2010
22 22 RhodeCode, a web based repository management based on pylons
23 23 versioning implementation: http://semver.org/
24 24 @author: marcink
25 25 """
26 26
27 VERSION = (1, 0, 0, 'rc3')
27 VERSION = (1, 0, 0, 'rc4')
28 28
29 29 __version__ = '.'.join((str(each) for each in VERSION[:4]))
30 30
31 31 def get_version():
32 32 """
33 33 Returns shorter version (digit parts only) as string.
34 34 """
35 35 return '.'.join((str(each) for each in VERSION[:3]))
@@ -1,161 +1,172 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # rhodecode - Pylons environment configuration #
4 4 # #
5 5 # The %(here)s variable will be replaced with the parent directory of this file#
6 6 ################################################################################
7 7
8 8 [DEFAULT]
9 9 debug = true
10 10 ################################################################################
11 11 ## Uncomment and replace with the address which should receive ##
12 12 ## any error reports after application crash ##
13 13 ## Additionally those settings will be used by rhodecode mailing system ##
14 14 ################################################################################
15 15 #email_to = admin@localhost
16 16 #error_email_from = paste_error@localhost
17 17 #app_email_from = rhodecode-noreply@localhost
18 18 #error_message =
19 19
20 20 #smtp_server = mail.server.com
21 21 #smtp_username =
22 22 #smtp_password =
23 23 #smtp_port =
24 24 #smtp_use_tls = false
25 25
26 26 [server:main]
27 27 ##nr of threads to spawn
28 28 threadpool_workers = 5
29 29
30 30 ##max request before thread respawn
31 31 threadpool_max_requests = 2
32 32
33 33 ##option to use threads of process
34 34 use_threadpool = true
35 35
36 36 use = egg:Paste#http
37 37 host = 127.0.0.1
38 38 port = 5000
39 39
40 40 [app:main]
41 41 use = egg:rhodecode
42 42 full_stack = true
43 43 static_files = true
44 44 lang=en
45 45 cache_dir = %(here)s/data
46 46 app_instance_uuid = ${app_instance_uuid}
47 47
48 48 ####################################
49 49 ### BEAKER CACHE ####
50 50 ####################################
51 beaker.cache.data_dir=/%(here)s/data/cache/data
52 beaker.cache.lock_dir=/%(here)s/data/cache/lock
53 beaker.cache.regions=super_short_term,short_term,long_term
54 beaker.cache.long_term.type=memory
55 beaker.cache.long_term.expire=36000
56 beaker.cache.short_term.type=memory
57 beaker.cache.short_term.expire=60
58 beaker.cache.super_short_term.type=memory
59 beaker.cache.super_short_term.expire=10
51 beaker.cache.data_dir=/%(here)s/data/cache/data
52 beaker.cache.lock_dir=/%(here)s/data/cache/lock
53 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
54 beaker.cache.long_term.type=memory
55 beaker.cache.long_term.expire=36000
56
57 beaker.cache.short_term.type=memory
58 beaker.cache.short_term.expire=60
59
60 beaker.cache.super_short_term.type=memory
61 beaker.cache.super_short_term.expire=10
62
63 beaker.cache.sql_cache_short.type=memory
64 beaker.cache.sql_cache_short.expire=5
65
66 beaker.cache.sql_cache_med.type=memory
67 beaker.cache.sql_cache_med.expire=360
68
69 beaker.cache.sql_cache_long.type=file
70 beaker.cache.sql_cache_long.expire=3600
60 71
61 72 ####################################
62 73 ### BEAKER SESSION ####
63 74 ####################################
64 75 ## Type of storage used for the session, current types are
65 ## dbm, file, memcached, database, and memory.
76 ## "dbm", "file", "memcached", "database", and "memory".
66 77 ## The storage uses the Container API
67 78 ##that is also used by the cache system.
68 79 beaker.session.type = file
69 80
70 81 beaker.session.key = rhodecode
71 82 beaker.session.secret = ${app_instance_secret}
72 83 beaker.session.timeout = 36000
73 84
74 85 ##auto save the session to not to use .save()
75 86 beaker.session.auto = False
76 87
77 88 ##true exire at browser close
78 89 #beaker.session.cookie_expires = 3600
79 90
80 91
81 92 ################################################################################
82 93 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
83 94 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
84 95 ## execute malicious code after an exception is raised. ##
85 96 ################################################################################
86 97 set debug = false
87 98
88 99 ##################################
89 100 ### LOGVIEW CONFIG ###
90 101 ##################################
91 102 logview.sqlalchemy = #faa
92 103 logview.pylons.templating = #bfb
93 104 logview.pylons.util = #eee
94 105
95 106 #########################################################
96 107 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
97 108 #########################################################
98 109 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
99 110 #sqlalchemy.db1.echo = False
100 111 #sqlalchemy.db1.pool_recycle = 3600
101 112 sqlalchemy.convert_unicode = true
102 113
103 114 ################################
104 115 ### LOGGING CONFIGURATION ####
105 116 ################################
106 117 [loggers]
107 118 keys = root, routes, rhodecode, sqlalchemy
108 119
109 120 [handlers]
110 121 keys = console
111 122
112 123 [formatters]
113 124 keys = generic,color_formatter
114 125
115 126 #############
116 127 ## LOGGERS ##
117 128 #############
118 129 [logger_root]
119 130 level = INFO
120 131 handlers = console
121 132
122 133 [logger_routes]
123 134 level = INFO
124 135 handlers = console
125 136 qualname = routes.middleware
126 137 # "level = DEBUG" logs the route matched and routing variables.
127 138
128 139 [logger_rhodecode]
129 140 level = DEBUG
130 141 handlers = console
131 142 qualname = rhodecode
132 143 propagate = 0
133 144
134 145 [logger_sqlalchemy]
135 146 level = ERROR
136 147 handlers = console
137 148 qualname = sqlalchemy.engine
138 149 propagate = 0
139 150
140 151 ##############
141 152 ## HANDLERS ##
142 153 ##############
143 154
144 155 [handler_console]
145 156 class = StreamHandler
146 157 args = (sys.stderr,)
147 158 level = NOTSET
148 159 formatter = color_formatter
149 160
150 161 ################
151 162 ## FORMATTERS ##
152 163 ################
153 164
154 165 [formatter_generic]
155 166 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
156 167 datefmt = %Y-%m-%d %H:%M:%S
157 168
158 169 [formatter_color_formatter]
159 170 class=rhodecode.lib.colored_formatter.ColorFormatter
160 171 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
161 172 datefmt = %Y-%m-%d %H:%M:%S No newline at end of file
@@ -1,90 +1,96 b''
1 1 #!/usr/bin/env python
2 2 # encoding: utf-8
3 3 # changelog controller for pylons
4 4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 5 #
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; version 2
9 9 # of the License or (at your opinion) any later version of the license.
10 10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19 # MA 02110-1301, USA.
20 20 """
21 21 Created on April 21, 2010
22 22 changelog controller for pylons
23 23 @author: marcink
24 24 """
25 from json import dumps
25
26 26 from mercurial.graphmod import colored, CHANGESET, revisions as graph_rev
27 27 from pylons import request, session, tmpl_context as c
28 28 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
29 29 from rhodecode.lib.base import BaseController, render
30 30 from rhodecode.model.hg_model import HgModel
31 31 from webhelpers.paginate import Page
32 32 import logging
33 33 log = logging.getLogger(__name__)
34 34
35 try:
36 import json
37 except ImportError:
38 #python 2.5 compatibility
39 import simplejson as json
40
35 41 class ChangelogController(BaseController):
36 42
37 43 @LoginRequired()
38 44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
39 45 'repository.admin')
40 46 def __before__(self):
41 47 super(ChangelogController, self).__before__()
42 48
43 49 def index(self):
44 50 limit = 100
45 51 default = 20
46 52 if request.params.get('size'):
47 53 try:
48 54 int_size = int(request.params.get('size'))
49 55 except ValueError:
50 56 int_size = default
51 57 int_size = int_size if int_size <= limit else limit
52 58 c.size = int_size
53 59 session['changelog_size'] = c.size
54 60 session.save()
55 61 else:
56 62 c.size = int(session.get('changelog_size', default))
57 63
58 64 changesets = HgModel().get_repo(c.repo_name)
59 65
60 66 p = int(request.params.get('page', 1))
61 67 c.total_cs = len(changesets)
62 68 c.pagination = Page(changesets, page=p, item_count=c.total_cs,
63 69 items_per_page=c.size)
64 70
65 71 self._graph(changesets, c.size, p)
66 72
67 73 return render('changelog/changelog.html')
68 74
69 75
70 76 def _graph(self, repo, size, p):
71 77 revcount = size
72 if not repo.revisions:return dumps([]), 0
78 if not repo.revisions:return json.dumps([]), 0
73 79
74 80 max_rev = repo.revisions[-1]
75 81 offset = 1 if p == 1 else ((p - 1) * revcount + 1)
76 82 rev_start = repo.revisions[(-1 * offset)]
77 83
78 84 revcount = min(max_rev, revcount)
79 85 rev_end = max(0, rev_start - revcount)
80 86 dag = graph_rev(repo.repo, rev_start, rev_end)
81 87
82 88 c.dag = tree = list(colored(dag))
83 89 data = []
84 90 for (id, type, ctx, vtx, edges) in tree:
85 91 if type != CHANGESET:
86 92 continue
87 93 data.append(('', vtx, edges))
88 94
89 c.jsdata = dumps(data)
95 c.jsdata = json.dumps(data)
90 96
@@ -1,104 +1,108 b''
1 1 #!/usr/bin/env python
2 2 # encoding: utf-8
3 3 # summary controller for pylons
4 4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 5 #
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; version 2
9 9 # of the License or (at your opinion) any later version of the license.
10 10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19 # MA 02110-1301, USA.
20 20 """
21 21 Created on April 18, 2010
22 22 summary controller for pylons
23 23 @author: marcink
24 24 """
25 25 from pylons import tmpl_context as c, request, url
26 26 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
27 27 from rhodecode.lib.base import BaseController, render
28 28 from rhodecode.lib.utils import OrderedDict
29 29 from rhodecode.model.hg_model import HgModel
30 30 from rhodecode.model.db import Statistics
31 31 from webhelpers.paginate import Page
32 32 from rhodecode.lib.celerylib import run_task
33 33 from rhodecode.lib.celerylib.tasks import get_commits_stats
34 34 from datetime import datetime, timedelta
35 35 from time import mktime
36 36 import calendar
37 37 import logging
38 import json
38 try:
39 import json
40 except ImportError:
41 #python 2.5 compatibility
42 import simplejson as json
39 43 log = logging.getLogger(__name__)
40 44
41 45 class SummaryController(BaseController):
42 46
43 47 @LoginRequired()
44 48 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
45 49 'repository.admin')
46 50 def __before__(self):
47 51 super(SummaryController, self).__before__()
48 52
49 53 def index(self):
50 54 hg_model = HgModel()
51 55 c.repo_info = hg_model.get_repo(c.repo_name)
52 56 c.repo_changesets = Page(list(c.repo_info[:10]), page=1, items_per_page=20)
53 57 e = request.environ
54 58
55 59 uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % {
56 60 'protocol': e.get('wsgi.url_scheme'),
57 61 'user':str(c.rhodecode_user.username),
58 62 'host':e.get('HTTP_HOST'),
59 63 'prefix':e.get('SCRIPT_NAME'),
60 64 'repo_name':c.repo_name, }
61 65 c.clone_repo_url = uri
62 66 c.repo_tags = OrderedDict()
63 67 for name, hash in c.repo_info.tags.items()[:10]:
64 68 c.repo_tags[name] = c.repo_info.get_changeset(hash)
65 69
66 70 c.repo_branches = OrderedDict()
67 71 for name, hash in c.repo_info.branches.items()[:10]:
68 72 c.repo_branches[name] = c.repo_info.get_changeset(hash)
69 73
70 74 td = datetime.today() + timedelta(days=1)
71 75 y, m, d = td.year, td.month, td.day
72 76
73 77 ts_min_y = mktime((y - 1, (td - timedelta(days=calendar.mdays[m])).month,
74 78 d, 0, 0, 0, 0, 0, 0,))
75 79 ts_min_m = mktime((y, (td - timedelta(days=calendar.mdays[m])).month,
76 80 d, 0, 0, 0, 0, 0, 0,))
77 81
78 82 ts_max_y = mktime((y, m, d, 0, 0, 0, 0, 0, 0,))
79 83
80 84 run_task(get_commits_stats, c.repo_info.name, ts_min_y, ts_max_y)
81 85 c.ts_min = ts_min_m
82 86 c.ts_max = ts_max_y
83 87
84 88 stats = self.sa.query(Statistics)\
85 89 .filter(Statistics.repository == c.repo_info.dbrepo)\
86 90 .scalar()
87 91
88 92
89 93 if stats and stats.languages:
90 94 lang_stats = json.loads(stats.languages)
91 95 c.commit_data = stats.commit_activity
92 96 c.overview_data = stats.commit_activity_combined
93 97 c.trending_languages = json.dumps(OrderedDict(
94 98 sorted(lang_stats.items(), reverse=True,
95 99 key=lambda k: k[1])[:2]
96 100 )
97 101 )
98 102 else:
99 103 c.commit_data = json.dumps({})
100 104 c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 0] ])
101 105 c.trending_languages = json.dumps({})
102 106
103 107 return render('summary/summary.html')
104 108
@@ -1,63 +1,26 b''
1 1 """SQLAlchemy Metadata and Session object"""
2 2 from sqlalchemy.ext.declarative import declarative_base
3 3 from sqlalchemy.orm import scoped_session, sessionmaker
4 4 from rhodecode.model import caching_query
5 5 from beaker import cache
6 import os
7 from os.path import join as jn, dirname as dn, abspath
8 import time
9 6
10 7 # Beaker CacheManager. A home base for cache configurations.
11 8 cache_manager = cache.CacheManager()
12 9
13 10 __all__ = ['Base', 'Session']
14 11 #
15 12 # SQLAlchemy session manager. Updated by model.init_model()
16 13 #
17 14 Session = scoped_session(
18 15 sessionmaker(
19 16 query_cls=caching_query.query_callable(cache_manager)
20 17 )
21 18 )
22 19
23 20 # The declarative Base
24 21 Base = declarative_base()
25 22 #For another db...
26 23 #Base2 = declarative_base()
27 24
28 #===============================================================================
29 # CACHE OPTIONS
30 #===============================================================================
31 cache_base = jn(dn(dn(dn(abspath(__file__)))), 'data')
32 cache_dir = jn(cache_base, 'cache')
33
34 if not os.path.isdir(cache_base):
35 os.mkdir(cache_base)
36
37 if not os.path.isdir(cache_dir):
38 os.mkdir(cache_dir)
39 # set start_time to current time
40 # to re-cache everything
41 # upon application startup
42 start_time = time.time()
43 # configure the "sqlalchemy" cache region.
44 cache_manager.regions['sql_cache_short'] = {
45 'type':'memory',
46 'data_dir':cache_dir,
47 'expire':10,
48 'start_time':start_time
49 }
50 cache_manager.regions['sql_cache_med'] = {
51 'type':'memory',
52 'data_dir':cache_dir,
53 'expire':360,
54 'start_time':start_time
55 }
56 cache_manager.regions['sql_cache_long'] = {
57 'type':'file',
58 'data_dir':cache_dir,
59 'expire':3600,
60 'start_time':start_time
61 }
62 25 #to use cache use this in query
63 26 #.options(FromCache("sqlalchemy_cache_type", "cachekey"))
@@ -1,34 +1,42 b''
1 1 [egg_info]
2 tag_build = rc3
2 tag_build = rc4
3 3 tag_svn_revision = true
4 4
5 5 [easy_install]
6 6 find_links = http://www.pylonshq.com/download/
7 7
8 8 [nosetests]
9 9 verbose=True
10 10 verbosity=2
11 11 with-pylons=test.ini
12 12 detailed-errors=1
13 13
14 14 # Babel configuration
15 15 [compile_catalog]
16 16 domain = rhodecode
17 17 directory = rhodecode/i18n
18 18 statistics = true
19 19
20 20 [extract_messages]
21 21 add_comments = TRANSLATORS:
22 22 output_file = rhodecode/i18n/rhodecode.pot
23 23 width = 80
24 24
25 25 [init_catalog]
26 26 domain = rhodecode
27 27 input_file = rhodecode/i18n/rhodecode.pot
28 28 output_dir = rhodecode/i18n
29 29
30 30 [update_catalog]
31 31 domain = rhodecode
32 32 input_file = rhodecode/i18n/rhodecode.pot
33 33 output_dir = rhodecode/i18n
34 34 previous = true
35
36 [build_sphinx]
37 source-dir = docs/
38 build-dir = docs/_build
39 all_files = 1
40
41 [upload_sphinx]
42 upload-dir = docs/_build/html No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now