I suppose that you can do what you want, but in deployment static files like js and css files are usually served by the front end (apache, for example), while, despite the .html, templates are not static files, and should never be served as is, only through the django template engine. It is reasonably easy to set up apache to serve a directory's content, including that in sub-directories, while I don't know how to go about keeping it from serving templates in the same directory.
Too bad they feel far away. What are you using to edit them? Bill On Mon, Jan 18, 2010 at 8:49 AM, Stephan Walter <step...@walter.name> wrote: > Hi, > After having Django used a long time ago, I recently started a new > project, using "django-admin.py startproject". What I found > inconvenient is that in the default project layout, the templates and > the static media are so "far away" from each other. > > What I mean is this: In the default structure, and also most layouts > I've seen proposed in various blog posts etc, the file are arranged > like this: > > my_site/ > settings.py > urls.py > static/ > css/ > foo.css > js/ > foo.js > images/ > templates/ > my_app/ > base.html > foo.html > my_app/ > models.py > views.py > > Now in my project there is a lot of client-side program logic, which > means a lot of interaction between the HTML and Javascript/CSS. Say > I'm editing the template foo.html, I'll likely need to edit foo.js and > foo.css as well. But these are some two levels up and two levels down > again in the directory hierarchy. > > Now what I'd like to do is something like this: > > my_site/ > settings.py > urls.py > client/ > base.html > foo/ > foo.html > foo.css > foo.js > bar/ > bar.html > server/ > models.py > views.py > > That is, both MEDIA_ROOT and TEMPLATE_DIRS would point to > my_site/client/. Of course I would forbid the webserver to serve the > un-parsed HTML files. > > Are there any reasons not to organise my project like this? And at the > risk of beating a dead horse with this topic, what are your > suggestions to organize a small project that will not be > redistributed/packaged/used elsewhere? > > -Stephan Walter > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > >
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.