Skip to content

Commit

Permalink
[#1267] fix url for by faking routes threadlocal
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Oct 11, 2013
1 parent b218294 commit fc10977
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ckan/lib/cli.py
Expand Up @@ -10,6 +10,8 @@
import ckan.include.rcssmin as rcssmin
import ckan.lib.fanstatic_resources as fanstatic_resources
import sqlalchemy as sa
import urlparse
import routes

import paste.script
from paste.registry import Registry
Expand Down Expand Up @@ -99,6 +101,12 @@ def _load_config(self):
self.translator_obj = MockTranslator()
self.registry.register(pylons.translator, self.translator_obj)

## give routes enough information to run url_for
parsed = urlparse.urlparse(conf.get('ckan.site_url', 'http://0.0.0.0'))
request_config = routes.request_config()
request_config.host = parsed.netloc + parsed.path
request_config.protocol = parsed.scheme

def _setup_app(self):
cmd = paste.script.appinstall.SetupCommand('setup-app')
cmd.run([self.filename])
Expand Down

0 comments on commit fc10977

Please sign in to comment.