Skip to content

Commit

Permalink
* static/template_roots are generated automatically.
Browse files Browse the repository at this point in the history
* Now defaults to the full path, so you don't need to change
  the default if using something like mod_wsgi
  • Loading branch information
breily committed Mar 13, 2009
1 parent 7155214 commit 696add2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions juno.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def __init__(self, configuration=None):
print >>sys.stderr, ' you might get some weird behavior.'
else: _hub = self
self.routes = []
# Join the path to the app's current location
def join_app_path(path):
return os.path.join(os.path.abspath(sys.path[0]), path)
# Set options and merge in user-set options
self.config = {
# General settings
Expand All @@ -32,7 +35,7 @@ def __init__(self, configuration=None):
# Static file handling
'use_static': True,
'static_url': '/static/*:file/',
'static_root': os.getcwd() + '/static/',
'static_root': join_app_path('static/'),
'static_handler': static_serve,
# Template options
'use_templates': True,
Expand All @@ -41,7 +44,7 @@ def __init__(self, configuration=None):
'render_template_handler': _render_template_handler,
'auto_reload_templates': True,
'template_kwargs': {},
'template_root': os.getcwd() + '/templates/',
'template_root': join_app_path('templates/'),
'404_template': '404.html',
'500_template': '500.html',
# Database options
Expand Down

0 comments on commit 696add2

Please sign in to comment.