Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload templates without restarting #173

Merged
merged 5 commits into from
Jun 14, 2018

Conversation

JamesGardiner
Copy link
Contributor

Motivation and Context

Autoreloads templates when running debug mode. Developers will see changes to html templates without having to restart a running server.

What has changed

Added new config to config.py to set auto reloading to true and to enable more verbose output of template loading information.

How to test?

  • Run the server either under ras-rm-docker-dev or locally.
  • Make sure the app is running in debug mode.
  • Navigate to the sign in page.
  • Alter the source code for one of the relevant templates.
  • Reload the page, check the change is visible.

@codecov
Copy link

codecov bot commented Jun 13, 2018

Codecov Report

Merging #173 into master will decrease coverage by 0.05%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #173      +/-   ##
==========================================
- Coverage   96.26%   96.21%   -0.06%     
==========================================
  Files          36       36              
  Lines        1768     1770       +2     
==========================================
+ Hits         1702     1703       +1     
- Misses         66       67       +1
Impacted Files Coverage Δ
response_operations_ui/__init__.py 76.74% <50%> (-1.31%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cae26fa...34e84ae. Read the comment docs.

Copy link
Contributor

@benjefferies benjefferies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it and it looks all good

Copy link
Contributor

@jcox-dev jcox-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. Not sure if explain is needed though.

config.py Outdated
@@ -104,6 +104,9 @@ class DevelopmentConfig(Config):
SURVEY_PASSWORD = os.getenv('SURVEY_PASSWORD', 'secret')
SURVEY_AUTH = (SURVEY_USERNAME, SURVEY_PASSWORD)

TEMPLATES_AUTO_RELOAD = True
EXPLAIN_TEMPLATE_LOADING = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want EXPLAIN_TEMPLATE_LOADING on by default? It does tend to flood logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good point. It can be useful if there are issues around template loading. I'll conduct a straw poll tomorrow and see what people prefer.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is TEMPLATES_AUTO_RELOAD needed? See pallets/flask#1907 and pyvec/elsa#44

@jcox-dev
Copy link
Contributor

@@ -7,7 +7,7 @@ url = "https://pypi.python.org/simple"
python_version = "3.6"

[packages]
Flask = "==0.12.2"
Flask = "==0.12"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@JamesGardiner JamesGardiner merged commit cce741c into master Jun 14, 2018
@JamesGardiner JamesGardiner deleted the eliminate_template_cache_in_debug branch June 14, 2018 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants