Show More
@@ -8,4 +8,6 b' syntax: regexp' | |||||
8 | syntax: regexp |
|
8 | syntax: regexp | |
9 | ^\.pydevproject$ |
|
9 | ^\.pydevproject$ | |
10 | syntax: regexp |
|
10 | syntax: regexp | |
11 | ^hg_app\.db$ No newline at end of file |
|
11 | ^hg_app\.db$ | |
|
12 | syntax: regexp | |||
|
13 | ^repositories\.config$ No newline at end of file |
@@ -40,16 +40,15 b' Installation' | |||||
40 | I recomend to install tip version of vcs while the app is in beta mode. |
|
40 | I recomend to install tip version of vcs while the app is in beta mode. | |
41 |
|
41 | |||
42 |
|
42 | |||
43 | - create new virtualenv and activate it |
|
43 | - create new virtualenv and activate it - highly recommend that you use separate | |
|
44 | virtual-env for whole application | |||
44 | - download hg app from default (not demo) branch from bitbucket and run |
|
45 | - download hg app from default (not demo) branch from bitbucket and run | |
45 | 'python setup.py install' this will install all required dependencies needed |
|
46 | 'python setup.py install' this will install all required dependencies needed | |
46 | - goto pylons_app/lib and run python db_manage.py it should create all |
|
47 | - run paster setup-app production.ini it should create all needed tables | |
47 | needed tables and an admin account. You can play with this file if you wish to |
|
48 | and an admin account. Also it will create repositories.config for mercurial | |
48 | use different db than sqlite |
|
49 | commands, remember that the given path for mercurial repositories must be write | |
49 | - edit file repositories.config and change the [paths] where you keep your |
|
50 | accessible for the application | |
50 | mercurial repositories, remember about permissions for accessing this dir by |
|
51 | - run paster serve development.ini - or you can use manage-hg_app script. | |
51 | hg app. |
|
|||
52 | - run paster serve development.ini |
|
|||
53 | the app should be available at the 127.0.0.1:5000 |
|
52 | the app should be available at the 127.0.0.1:5000 | |
54 | - use admin account you created to login. |
|
53 | - use admin account you created to login. | |
55 | - default permissions on each repository is read, and owner is admin. So remember |
|
54 | - default permissions on each repository is read, and owner is admin. So remember |
@@ -11,4 +11,4 b' baseurl = /' | |||||
11 |
|
11 | |||
12 | [paths] |
|
12 | [paths] | |
13 | #this path should point to mercurial repositories remeber about '*' at the end |
|
13 | #this path should point to mercurial repositories remeber about '*' at the end | |
14 | / = /home/marcink/python_workspace/* |
|
14 | / = %(repo_location)s |
@@ -27,6 +27,7 b' database managment and creation for hg a' | |||||
27 | from os.path import dirname as dn, join as jn |
|
27 | from os.path import dirname as dn, join as jn | |
28 | import os |
|
28 | import os | |
29 | import sys |
|
29 | import sys | |
|
30 | import uuid | |||
30 | ROOT = dn(dn(dn(os.path.realpath(__file__)))) |
|
31 | ROOT = dn(dn(dn(os.path.realpath(__file__)))) | |
31 | sys.path.append(ROOT) |
|
32 | sys.path.append(ROOT) | |
32 |
|
33 | |||
@@ -41,7 +42,7 b" log = logging.getLogger('db manage')" | |||||
41 | log.setLevel(logging.DEBUG) |
|
42 | log.setLevel(logging.DEBUG) | |
42 | console_handler = logging.StreamHandler() |
|
43 | console_handler = logging.StreamHandler() | |
43 | console_handler.setFormatter(logging.Formatter("%(asctime)s.%(msecs)03d" |
|
44 | console_handler.setFormatter(logging.Formatter("%(asctime)s.%(msecs)03d" | |
44 |
|
|
45 | " %(levelname)-5.5s [%(name)s] %(message)s")) | |
45 | log.addHandler(console_handler) |
|
46 | log.addHandler(console_handler) | |
46 |
|
47 | |||
47 | class DbManage(object): |
|
48 | class DbManage(object): | |
@@ -85,10 +86,10 b' class DbManage(object):' | |||||
85 | #create default user for handling default permissions. |
|
86 | #create default user for handling default permissions. | |
86 | def_user = User() |
|
87 | def_user = User() | |
87 | def_user.username = 'default' |
|
88 | def_user.username = 'default' | |
88 | def_user.password = 'default' |
|
89 | def_user.password = get_crypt_password(str(uuid.uuid1())[:8]) | |
89 | def_user.name = 'default' |
|
90 | def_user.name = 'default' | |
90 | def_user.lastname = 'default' |
|
91 | def_user.lastname = 'default' | |
91 | def_user.email = 'default@default' |
|
92 | def_user.email = 'default@default.com' | |
92 | def_user.admin = False |
|
93 | def_user.admin = False | |
93 | def_user.active = False |
|
94 | def_user.active = False | |
94 |
|
95 | |||
@@ -131,13 +132,3 b' class DbManage(object):' | |||||
131 | except: |
|
132 | except: | |
132 | self.sa.rollback() |
|
133 | self.sa.rollback() | |
133 | raise |
|
134 | raise | |
134 |
|
||||
135 |
|
||||
136 |
|
||||
137 | if __name__ == '__main__': |
|
|||
138 | dbmanage = DbManage(log_sql=True) |
|
|||
139 | dbmanage.create_tables(override=True) |
|
|||
140 | dbmanage.admin_prompt() |
|
|||
141 | dbmanage.create_permissions() |
|
|||
142 |
|
||||
143 |
|
@@ -1,9 +1,49 b'' | |||||
1 | """Setup the pylons_app application""" |
|
1 | """Setup the pylons_app application""" | |
|
2 | ||||
|
3 | from os.path import dirname as dn, join as jn | |||
|
4 | from pylons_app.config.environment import load_environment | |||
|
5 | from pylons_app.lib.db_manage import DbManage | |||
2 | import logging |
|
6 | import logging | |
3 | from pylons_app.config.environment import load_environment |
|
7 | import os | |
|
8 | import sys | |||
|
9 | ||||
4 | log = logging.getLogger(__name__) |
|
10 | log = logging.getLogger(__name__) | |
5 |
|
11 | |||
|
12 | ROOT = dn(dn(os.path.realpath(__file__))) | |||
|
13 | sys.path.append(ROOT) | |||
|
14 | ||||
|
15 | ||||
|
16 | def setup_repository(): | |||
|
17 | log.info('Seting up repositories.config') | |||
|
18 | fname = 'repositories.config' | |||
|
19 | ||||
|
20 | try: | |||
|
21 | tmpl = open(jn(ROOT, 'pylons_app', 'config', 'repositories.config_tmpl')).read() | |||
|
22 | except IOError: | |||
|
23 | raise | |||
|
24 | ||||
|
25 | path = raw_input('Specify valid full path to your repositories' | |||
|
26 | ' you can change this later in repositories.config file:') | |||
|
27 | ||||
|
28 | if not os.path.isdir(path): | |||
|
29 | log.error('You entered wrong path') | |||
|
30 | sys.exit() | |||
|
31 | ||||
|
32 | ||||
|
33 | path = jn(path, '*') | |||
|
34 | dest_path = jn(ROOT, fname) | |||
|
35 | f = open(dest_path, 'wb') | |||
|
36 | f.write(tmpl % {'repo_location':path}) | |||
|
37 | f.close() | |||
|
38 | log.info('created repositories.config in %s', dest_path) | |||
|
39 | ||||
6 |
|
40 | |||
7 | def setup_app(command, conf, vars): |
|
41 | def setup_app(command, conf, vars): | |
8 | """Place any commands to setup pylons_app here""" |
|
42 | """Place any commands to setup pylons_app here""" | |
|
43 | setup_repository() | |||
|
44 | dbmanage = DbManage(log_sql=True) | |||
|
45 | dbmanage.create_tables(override=True) | |||
|
46 | dbmanage.admin_prompt() | |||
|
47 | dbmanage.create_permissions() | |||
9 | load_environment(conf.global_conf, conf.local_conf) |
|
48 | load_environment(conf.global_conf, conf.local_conf) | |
|
49 |
General Comments 0
You need to be logged in to leave comments.
Login now