Closed chrisfranklin closed 12 years ago
Thanks for the pull request. I think you may have forgotten a file in your commit--sitebase.html
doesn't exist, so as-is this throws an Exception when TemplatesGenerator
attempts to render this template.
Here's the full trace:
(scaffoldtest)modocache ~/test $ python manage.py generatescaffold bathroom ToiletPaper is_soft:bool
backup bathroom/models.py
exists bathroom/views
exists bathroom/views/__init__.py
exists bathroom/urls.py
backup bathroom/urls.py
exists bathroom/templates
exists bathroom/templates/bathroom
create bathroom/templates/bathroom/toiletpaper
revert bathroom/models.py
revert bathroom/views/toiletpaper_views.py
revert bathroom/urls.py
revert bathroom/templates/bathroom/toiletpaper
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/generate_scaffold/management/commands/generatescaffold.py", line 262, in handle
for dst_abspath, rendered_template in rendered_templates:
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/generate_scaffold/generators/templates.py", line 51, in render_templates
rendered_template = t.render(Context(c))
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/base.py", line 140, in render
return self._render(context)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/debug.py", line 74, in render_node
return node.render(context)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader_tags.py", line 101, in render
compiled_parent = self.get_parent(context)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader_tags.py", line 98, in get_parent
return get_template(parent)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader.py", line 145, in get_template
template, origin = find_template(template_name)
File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
django.template.base.TemplateDoesNotExist: sitebase.html
(scaffoldtest)modocache ~/test $
That being said, I'm not sure what moving the CSS and footer to a parent template will accomplish--it seems to me it would just make it harder for a developer to replace the scaffold templates with their own. Could you explain to me what your motivations for this change are?
Hey man,
Thanks for getting back to me, this is all rather exciting I must say, never put in a pull request before. The motivation for moving the files out to a base template is so that the user can more easily change the style sheet. As it is the user would have to make changes in multiple places in order to change the basic styling of the page. It makes more sense to have the generated applications match the visual feel of the rest of the project. I find myself making this change every single time I run this application.
So this leaves two options I guess, one would be to provide a sitebase.html and the other is to assume (a fair assumption) that the user will define their own (maybe provide them a starting point but really most developers will have a parent template I reckon. Let me have a bit more of a think about how this would work and I will get back to in the week.
Cheers for your time, good work with the application!
Chris
On Sun, Jun 17, 2012 at 6:13 AM, Brian Gesiak < reply@reply.github.com
wrote:
Thanks for the pull request. I think you may have forgotten a file in your commit--
sitebase.html
doesn't exist, so as-is this throws an Exception whenTemplatesGenerator
attempts to render this template.Here's the full trace:
(scaffoldtest)modocache ~/test $ python manage.py generatescaffold bathroom ToiletPaper is_soft:bool backup bathroom/models.py exists bathroom/views exists bathroom/views/init.py exists bathroom/urls.py backup bathroom/urls.py exists bathroom/templates exists bathroom/templates/bathroom create bathroom/templates/bathroom/toiletpaper revert bathroom/models.py revert bathroom/views/toiletpaper_views.py revert bathroom/urls.py revert bathroom/templates/bathroom/toiletpaper Traceback (most recent call last): File "manage.py", line 10, in
execute_from_command_line(sys.argv) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/init.py", line 443, in execute_from_command_line utility.execute() File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/init.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(_args, _options.dict) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(_args, _options) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/generate_scaffold/management/commands/generatescaffold.py", line 262, in handle for dst_abspath, rendered_template in rendered_templates: File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/generate_scaffold/generators/templates.py", line 51, in render_templates rendered_template = t.render(Context(c)) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/base.py", line 140, in render return self._render(context) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/base.py", line 134, in _render return self.nodelist.render(context) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/base.py", line 823, in render bit = self.render_node(node, context) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/debug.py", line 74, in render_node return node.render(context) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader_tags.py", line 101, in render compiled_parent = self.get_parent(context) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader_tags.py", line 98, in get_parent return get_template(parent) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader.py", line 145, in get_template template, origin = find_template(template_name) File "/Users/modocache/.virtualenvs/scaffoldtest/lib/python2.7/site-packages/django/template/loader.py", line 138, in find_template raise TemplateDoesNotExist(name) django.template.base.TemplateDoesNotExist: sitebase.html (scaffoldtest)modocache ~/test $ That being said, I'm not sure what moving the CSS and footer to a parent template will accomplish--it seems to me it would just make it harder for a developer to replace the scaffold templates with their own. Could you explain to me what your motivations for this change are?
Reply to this email directly or view it on GitHub:
https://github.com/modocache/django-generate-scaffold/pull/5#issuecomment-6379003
While I think it's fair to assume most developers have the majority of templates extend a base template, there's no way to tell what that file would be called, and generate scaffold
is really only aiming to create a temporary set of files users (especially beginners) can use as a stepping stone.
If users want to use the scaffold as-is, for now they can change base.html
accordingly. I think that's a small price to pay, and a very simple operation, compared with the alternative--users experiencing TemplateDoesNotExist
errors when accessing pretty much any page (they all extend base.html
, after all).
Thanks for the pull request, though, and for taking an interest!
We can avoid including the CSS on every page and instead just extend sitebase.