Where is the ideal place for django's template? - django-templates

According to Brian's response, he recomends put template dir on the top level django project. In other responses find that every app should have its own template folder.
I wonder if there is an official recommendation or criteria as the peps in python, for the location of the template folder regardless of how many applications may have a django project

App-specific resources belong with the app. Project-wide resources or project-overridden resources belong with the project.

Related

Plugin for site variables?

I'm working on transferring a site from Docsify to Docusaurus. We use variables across the site for URL's, API calls, versions, etc. On docsify we used a variable plugin called docsify-variables and I am looking for a Docusaurus equivalent.
Does anyone know of a plugin or way to load site variables from a json file?
I tried looking for a plugin like this on the Docusaurus community plugin page as well as official ones but can't find what I'm looking for.

React native modularization

Currently, I need to modularize an app into smaller modules. As far as I've known, modularization is the concept of separating an app into smaller components, which will be developed by a specific team. Finally, these modules will be merged into a complete production. However, my manager wants to review/test these modules as standalone apps. For example, we have authentication module and news module. Normally, user need to authenticate first, then navigate to the Main Screen (which contains News Module). But in my case, we want to test/review News Module without the authentication step as a standalone app.
Through my research, I've found a library for modularization. But i don't know if this library can match the above requirements. Is there a more official way to do this without creating many different repo/npm library for each module? Have any teams faced this kind of modularization before? Thank you in advance!

Add Function to Existing Angular Controller in VirtoCommerce Storefront

I would like to add a function to the cartController (angular) in the storefront.
I could fork the storefront and then make my change and start loading only "my" storefront.
Is there a way to build my own module with the purpose of extending or overriding the controller so I can still use the base storefront module and just extend with my changes.
To extending storefront you should adhere to the following rules to be able to update to the latest storefront version without 'merging hell':
Try to avoid direct exist storefront controller changes, create own
controllers in separated solution folders with using prefixes for class and file names. e.g
VirtoCommerce.Storefront/MyExtension/myCartController
Register new routes and dependencies by modifying Startup.cs (it
is exception)
All storefront model classes marked as partial and will be easily
to split the definition over two or more source files within
VirtoCommerce.Model and VirtoCommerce.LiquidThemeEngine projects. e.g
VirtoCommerce.Storefront.Model/MyExtension/ShoppingCart.cs
About theme customization please read my answer on Starting VirtoCommerce Storefront Theme Development stackoverflow question
How to use new modules API in the storefront described in this article How to generate module API C# client using AutoRest
In this article you can see the overall solution development process.

Linking to External Resources in jsfiddle

Can someone explain how to find external resources for creating jsfiddle examples? I've been looking on github and plugin author's websites but there must be a standard method to get links to these files.
This example of the masonry layout:
However, I scavenged the resource from David Dsandro's dropbox.
http://dl.dropboxusercontent.com/u/1000295/jquery.masonry.min.js
I got the fiddle's masonry layout to work but linking by scavenging doesn't sound ethical.
There is no such thing. All you can do in the External Resources section is to provide a url to the library/plugin/css you want. The hotlinking ethics principles applies in jsfiddle as in any other website.
You can get that link in the traditional way, looking into the library's author site, or in a cdn. For example, cdnjs is a great site where you will possibly find the libs you need (including mansonry in this case). jsdelivr is another cdn hosting lots of libs that I've just discovered thanks to this question.
Take into account that you already have some plugins built-in in the Frameworks & Extensions section.

MVC4 Web API for web development and possibly mobile

I really like the new feature, Web API that's released with MVC4.
I'm currently working on a web application, that I will want to extend it to a mobile application.
What would be the best way of utilizing this feature?
Program it like there's no Web API, and when i'm ready to develop for a mobile application, then use this feature (Copy and paste controller functions then edit the return and error handling value ?
Or should I use Web API from the beginning of the web development. Using javascript to call functions and to handle errros? The problem with this apporach is I'm not too familiar with JS, and the code would not look very clean (the Views)
Any opinion?
Thanks
IMHO the Web API shouldn't be seen as a feature specific to mobile application development. It's a tool allowing you to easily expose RESTful APIs over HTTP. Those APIs could be consumed from desktop applications, web applications, mobile applications, etc ... The interface for each type of application will of course be developed using the specific frameworks and tools for this task (WPF, ASP.NET/MVC, WP7/iOS/Android, ...).
The Web API just allows you to expose your business data and services in an interoperable way so that different clients could consume them.
I would prefer using the second approach.
In the beginning, I also thought the .ajax calls might mess up the Views. (No one likes to add a long <script> section in a View.) But after asking my questions on Stackoverflow, I am glad to find some experts here using some "code-behind" for those javascript.
The practice is:
Create a separate JS folder to store all the "code-behind" js files. (The default Scripts folder only contains the third-party packages like knockout.js, jquery.js and etc)
For each view, generate a .js file, like home.index.js, form.add.js, etc. Just follow a consistent rule. There will be a lot of js files created. The great thing is in MVC4, we can combine all .js files under this folder and generate a minified, combined, single file, and load it only once in the _Layout view.
The way to do it is:
In _Layout view, <head> section:
<script src="#System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/JavaScripts/js")" type="text/javascript"></script>
In Global.asax, Application_Start, register the bundle:
var bundle = new Bundle("~/JavaScripts/js", new JsMinify());
bundle.AddDirectory("~/JavaScripts", "*.js", true);
BundleTable.Bundles.Add(bundle);
BundleTable.Bundles.EnableDefaultBundles();
//BundleTable.Bundles.RegisterTemplateBundles();
Then you are good to go. The Views are still clean. All the .js files are organized. And no need to import different .js file on each individual view.
Leaning JS is not a problem. As it is probably the only client-side programming language, it is now becoming necessary for us to learn new things. And I feel it is easier since we have jQuery now. It is time to upgrade our knowledge. I am happy and excited about what we can accomplish with these new tools.