These are chat archives for django/django

22nd
Jul 2017
djangoReactGuy
@SanskarSans
Jul 22 2017 13:21
anyone online?
I am getting problem when deploying to heroku
I get the following error
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
Brandon Carlino
@bacarlino
Jul 22 2017 16:51
Just curious what everyone here's preferred method for template directory structure is. After googling and reading and trying a few methods myself... I feel like I like having the templates broken out into the respected app directories (<app>/templates/<app>/<templatename.html>... this seems to make a lot of sense... but I have seen a few resources that suggest, recommend, or encourage placing ALL templates at the project level template directory (with individual app folders inside). I know ultimately it really doesn't matter right? It's personal preference... so... what is YOUR preference?
Sergii Smyrnov
@smirnoffs
Jul 22 2017 20:10
Doesn't matter at all. IMO it's so much easier to keep templates in applications, not in a single directory. It looks better, you can open a single app in your editor and have everything close to each other. The same is valid for tests, potentially you can make a common test folder, but why would you do that if you can a test folder inside your app which is much more logical?
Janusz KamieĊ„ski
@ivellios
Jul 22 2017 22:05

In fact it DOES matter. In smaller project it may seem better, but once project grow, you will use templatetags and context data from multiple apps nearly everywhere. Then if you include file from one app, use templatetag from other and so on it can get messy pretty fast. And you will have to jump from app to app and look where is the file you are looking for. It is much easier and keeps better consistency if you have them all in one place. Also keep in mind, that templates dir is usually overriding app templates directory. One step to the hell, when you have to find out, that the file from app overrides by some other file in general templates. Good luck!

In Two Scoops of Django they suggest using general templates dir located in the top of the structure along with settings, apps and so on. I find it most useful and easy to understand for other coders. Also it can be easier to use by front-end developers.

My personal choice is to use templates in apps just as a simple test templates to show, how template should look, what data use and so on. Just in case one day the app will be moved to a separate module.