Repository: sanic-org/sanic-ext (python)

Issue:
[Bug] direct set app.ext.config not working
**Describe the bug**
set template search pathes via
```python
app.config.TEMPLATING_PATH_TO_TEMPLATES = xxx
# OR
app.ext.config.TEMPLATING_PATH_TO_TEMPLATES = xxx
```
not working, sanic just use default `templates` dir
exception log
```
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/chendx/xxx/server/__init__.py", line 1, in <module>
    from .app import PigaiZiApp
  File "/Users/chendx/xxx/server/app.py", line 2, in <module>
    from .demo_handler import *
  File "/Users/chendx/xxx/server/demo_handler.py", line 8, in <module>
    @app.ext.template('demo.jinja2')
  File "/Users/chendx/anaconda3/envs/pigai/lib/python3.8/site-packages/sanic_ext/bootstrap.py", line 151, in template
    return self.templating.template(template_name, **kwargs)
  File "/Users/chendx/anaconda3/envs/pigai/lib/python3.8/site-packages/sanic_ext/extensions/templating/engine.py", line 30, in template
    template = self.environment.get_template(file_name)
  File "/Users/chendx/anaconda3/envs/pigai/lib/python3.8/site-packages/jinja2/environment.py", line 883, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/Users/chendx/anaconda3/envs/pigai/lib/python3.8/site-packages/jinja2/environment.py", line 857, in _load_template
    template = self.loader.load(self, name, globals)
  File "/Users/chendx/anaconda3/envs/pigai/lib/python3.8/site-packages/jinja2/loaders.py", line 115, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "/Users/chendx/anaconda3/envs/pigai/lib/python3.8/site-packages/jinja2/loaders.py", line 197, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: demo.jinja2
```

**Additional context**
I check the sanic_ext source code, before custom config been set, the template extend has been inited.




Pull request:
Add syncback of config values
Fix #91 

Patch:
diff --git a/sanic_ext/config.py b/sanic_ext/config.py
index 674f8de..8642570 100644
--- a/sanic_ext/config.py
+++ b/sanic_ext/config.py
@@ -108,5 +108,12 @@ def add_fallback_config(
     app.config.update(
         {key: value for key, value in config.items() if key not in app.config}
     )
+    config.update(
+        {
+            key: value
+            for key, value in app.config.items()
+            if key in config and value != config.get(key)
+        }
+    )
 
     return config


Test patch:
diff --git a/tests/extensions/templating/test_templating.py b/tests/extensions/templating/test_templating.py
index 1609252..3c554b1 100644
--- a/tests/extensions/templating/test_templating.py
+++ b/tests/extensions/templating/test_templating.py
@@ -85,3 +85,14 @@ def test_render_from_string():
     assert response.content_type == "text/html; charset=utf-8"
     assert "<li>three</li>" in response.text
     assert "<li>four</li>" in response.text
+
+
+def test_config_templating_dir():
+    app = Sanic("templating")
+    app.config.TEMPLATING_PATH_TO_TEMPLATES = (
+        Path(__file__).parent / "templates"
+    )
+
+    assert app.ext.templating.environment.get_template(
+        "foo.html"
+    ).filename == str(Path(__file__).parent / "templates" / "foo.html")