Size: 3593
Comment:
|
Size: 4176
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
How to setup FreeHg on your own server ====================================== |
= How to setup FreeHg on your own server = |
Line 95: | Line 94: |
== Installing in apache == Apache config: {{{ <VirtualHost *> ServerName freehg.org ServerAdmin your@email.com SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE freehg.settings PythonPath "['/path/to/freehg/parent/dir/'] + sys.path" <Location "/static"> SetHandler None </Location> Alias /static /path/to/freehg/htdocs/static </VirtualHost> }}} Then setup permissions {{{ $ chmod o+x freehg $ cd freehg $ chmod o+x database.dat }}} so that Apache can write to the database and create files in the freehg dir. |
How to setup FreeHg on your own server
Assuming you are using Debian unstable (it should be similar on other distributions).
sudo apt-get install -t experimental python-django hg clone http://freehg.org/u/mmarshall/freehg/ cd freehg cp default_settings.py settings.py
Apply the following patch:
# HG changeset patch # User Ondrej Certik <ondrej@certik.cz> # Date 1215091794 -7200 # Node ID e2055dc9678e37e8ec0e140ee76dfcefd0245ffe # Parent 9de77539abe2c32a2a1bdc35cc87fa872b96b3af summary view adapted to the latest mercurial diff --git a/repos/views.py b/repos/views.py --- a/repos/views.py +++ b/repos/views.py @@ -78,6 +78,7 @@ def summary(request, username, reponame) from mercurial.hgweb.hgweb_mod import hgweb from mercurial.hgweb.common import style_map from mercurial import templater + from mercurial.templatefilters import filters as common_filters from django.conf import settings web = hgweb(hgrepo, name=repo.get_long_name()) web.refresh() @@ -85,7 +86,7 @@ def summary(request, username, reponame) yield web.config("web", "motd", "") templatepath = settings.HG_TEMPLATE_PATH mapfile = mapfile = style_map(templatepath, "freehg") - web.t = templater.templater(mapfile, templater.common_filters, + tmpl = templater.templater(mapfile, common_filters, defaults={"url": request.build_absolute_uri(), "staticurl": "/static/", "urlbase": "/", @@ -106,7 +107,7 @@ def summary(request, username, reponame) else: # FIXME I have a feeling that this isn't correct. content.append(str(thing).decode('utf8')) - write(web.summary()) + write(web.summary(tmpl)) return render_to_response('repos/summary.html', dict(
And also this patch:
--- default_settings.py 2008-06-15 11:41:43.658803990 +0200 +++ settings.py 2008-07-03 15:18:54.245187159 +0200 @@ -7,10 +7,13 @@ # ('Your Name', 'your_email@domain.com'), ) +import os + MANAGERS = ADMINS -DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = '' # Or path to database file if using sqlite3. +DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. +#DATABASE_NAME = '' # Or path to database file if using sqlite3. +DATABASE_NAME = os.path.join(os.path.dirname(__file__), 'database.dat') DATABASE_USER = '' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. @@ -63,10 +66,15 @@ ROOT_URLCONF = 'freehg.urls' +HTPASSWD_FILE = os.path.join(os.path.dirname(__file__), 'htpasswd') +HG_TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'hgtemplates') +REPO_PATH = "/tmp/po" + TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. + os.path.join(os.path.dirname(__file__), 'templates'), ) INSTALLED_APPS = (
Create database tables:
./manage.py syncdb
(You can answer "no" to create superuser now.) Test it locally
./manage.py runserver
Installing in apache
Apache config:
<VirtualHost *> ServerName freehg.org ServerAdmin your@email.com SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE freehg.settings PythonPath "['/path/to/freehg/parent/dir/'] + sys.path" <Location "/static"> SetHandler None </Location> Alias /static /path/to/freehg/htdocs/static </VirtualHost>
Then setup permissions
$ chmod o+x freehg $ cd freehg $ chmod o+x database.dat
so that Apache can write to the database and create files in the freehg dir.