mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-06-04 12:49:55 -04:00
Add support for external config files (Fixes: #33)
This commit is contained in:
parent
f544d94a8c
commit
05d40216ee
3 changed files with 15 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
__pycache__
|
__pycache__
|
||||||
|
config.py
|
||||||
custom_templates
|
custom_templates
|
||||||
uploads
|
uploads
|
||||||
|
|
13
README.md
13
README.md
|
@ -190,12 +190,25 @@ The `key` parameter is the key from a previously uploaded file.
|
||||||
```
|
```
|
||||||
|
|
||||||
# Docker
|
# Docker
|
||||||
|
|
||||||
There are two Dockerfiles present in this repository. The file called `Dockerfile.development` is used for development
|
There are two Dockerfiles present in this repository. The file called `Dockerfile.development` is used for development
|
||||||
and `Dockerfile.production` is used for production deployments.
|
and `Dockerfile.production` is used for production deployments.
|
||||||
|
|
||||||
You can find the automated docker builds in the registry of this
|
You can find the automated docker builds in the registry of this
|
||||||
repository: https://0xacab.org/jvoisin/mat2-web/container_registry
|
repository: https://0xacab.org/jvoisin/mat2-web/container_registry
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
The default settings from `main.py` may be overridden by adding a `config.py`
|
||||||
|
file and add custom values for the relevant flask config variables. E.g.:
|
||||||
|
|
||||||
|
```
|
||||||
|
MAX_CONTENT_LENGTH = 32 * 1024 * 1024 # 32MB
|
||||||
|
```
|
||||||
|
|
||||||
|
See [Flask configuration docs](http://exploreflask.com/en/latest/configuration.html)
|
||||||
|
for further information.
|
||||||
|
|
||||||
# Custom templates
|
# Custom templates
|
||||||
|
|
||||||
You can override the default templates from `templates/` by putting replacements
|
You can override the default templates from `templates/` by putting replacements
|
||||||
|
|
1
main.py
1
main.py
|
@ -25,6 +25,7 @@ def create_app(test_config=None):
|
||||||
app.config['UPLOAD_FOLDER'] = './uploads/'
|
app.config['UPLOAD_FOLDER'] = './uploads/'
|
||||||
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB
|
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB
|
||||||
app.config['CUSTOM_TEMPLATES_DIR'] = 'custom_templates'
|
app.config['CUSTOM_TEMPLATES_DIR'] = 'custom_templates'
|
||||||
|
app.config.from_object('config') # optionally load settings from config.py
|
||||||
|
|
||||||
app.jinja_loader = jinja2.ChoiceLoader([ # type: ignore
|
app.jinja_loader = jinja2.ChoiceLoader([ # type: ignore
|
||||||
jinja2.FileSystemLoader(app.config['CUSTOM_TEMPLATES_DIR']),
|
jinja2.FileSystemLoader(app.config['CUSTOM_TEMPLATES_DIR']),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue