Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set template context debug=True with "cactus serve" unless "cactus serve --no-debug" #85

Open
wants to merge 2 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cactus/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def make_messages(path, config):
site.make_messages()


def serve(path, config, port, browser):
def serve(path, config, port, browser, no_debug):
"""Serve the project and watch changes"""
site = cactus.Site(path, config)
site = cactus.Site(path, config, debug=not no_debug)
site.serve(port=port, browser=browser)

def domain_setup(path, config):
Expand Down Expand Up @@ -85,6 +85,7 @@ def main():
parser_serve.add_argument('-p', '--port', default = 8000, type = int, help = 'The port on which to serve the site.')
parser_serve.add_argument('-b', '--browser', action = 'store_true',
help = 'Whether to open a browser for the site.')
parser_serve.add_argument('--no-debug', default = False, action = 'store_true', help = 'Disable debug mode.')

parser_make_messages = subparsers.add_parser('messages:make', help='Create translation files for the current project')
parser_make_messages.set_defaults(target=make_messages)
Expand Down
4 changes: 2 additions & 2 deletions cactus/deployment/s3/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class S3DeploymentEngine(BaseDeploymentEngine):
config_bucket_name = "aws-bucket-name"
config_bucket_website = "aws-bucket-website"

_s3_api_endpoint = 's3.amazonaws.com'
#_s3_api_endpoint = 's3.amazonaws.com'
_s3_port = 443
_s3_is_secure = True
_s3_https_connection_factory = None
Expand All @@ -48,7 +48,7 @@ def _create_connection(self):
aws_access_key, aws_secret_key = self.credentials_manager.get_credentials()

return boto.connect_s3(aws_access_key.strip(), aws_secret_key.strip(),
host=self._s3_api_endpoint, is_secure=self._s3_is_secure, port=self._s3_port,
is_secure=self._s3_is_secure, port=self._s3_port,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes in this file have nothing to do with the PR... +1 for the rest of the changes!

https_connection_factory=self._s3_https_connection_factory)

def get_bucket(self):
Expand Down
5 changes: 4 additions & 1 deletion cactus/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Site(SiteCompatibilityLayer):
_parallel = PARALLEL_CONSERVATIVE #TODO: Test me
_static = None

def __init__(self, path, config_paths=None, ui=None,
def __init__(self, path, config_paths=None, ui=None, debug=False,
PluginManagerClass=None, ExternalManagerClass=None, DeploymentEngineClass=None):

# Load the config engine
Expand All @@ -59,6 +59,7 @@ def __init__(self, path, config_paths=None, ui=None,
self.compress_extensions = self.config.get('compress', ['html', 'css', 'js', 'txt', 'xml'])
self.fingerprint_extensions = self.config.get('fingerprint', [])
self.locale = self.config.get("locale", None)
self.debug = debug

# Verify our location looks correct
self.path = path
Expand Down Expand Up @@ -149,6 +150,7 @@ def setup(self):
"USE_L10N": False,
"LANGUAGE_CODE": self.locale,
"LOCALE_PATHS": [self.locale_path],
"DEBUG": self.debug,
})

django.conf.settings.configure(**settings)
Expand Down Expand Up @@ -179,6 +181,7 @@ def context(self):
'static': [p for p in self.static()]
},
'__CACTUS_SITE__': self,
'debug': self.debug, # imitate django.core.context_processors.debug
}

# Also make lowercase work
Expand Down