3 ms·
"Why not create a ‘templates’ directoy and a ‘base.html’ either in project’s directory or in the apps’s directory, because creating the same templates directory
by arthurk 17y ago
"Why not create a ‘templates’ directoy and a ‘base.html’ either in project’s directory or in the apps’s directory, because creating the same templates directory and same base.html for every project is not DRY?"
There's nothing wrong with that. Even the djangoproject.com website does it: http://code.djangoproject.com/browser/djangoproject.com/django_website http://code.djangoproject.com/browser/djangoproject.com/djan...
"Why serving static files in development has to be a additional setup, as no developer wants to setup a server for serving static files, I am aware of ‘django.static.serve’ but still that is an additional setup, why not create a sample media directory and a url for the same in urls.py ?"
Read this: http://www.b-list.org/weblog/2008/jun/23/media/ http://www.b-list.org/weblog/2008/jun/23/media/
- ashok_raavi 17y agoThe question is, why not the framework create it automatically ? why one has to create it manually every time a project/app is created ? Atleast a default template directory and a standard base.html on a project level will reduce the repetitive work.
- roam 17y agoYou're right that it would be easier if some things were set to a reasonable default. But if you want it right now: create a custom command to do it your way and wrap it in an app that you add to the path. When you start a new project, the first thing you do is add the application to your installed apps and you can use it over and over again.
- kteague 17y agoThe question is, why use the framework to create the layout of project which happens to depend upon that framework at all? Instead, use a generic project templating tool to create the layout, then it's easy to choose alternate starting points depending upon what you need in your project. In Python, 'paster' is commonly used for this. It lets you create projects that depend upon TurboGears or Zope or Plone or Grok or even plain old Python projects which don't depend upon a full framework.