mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-04-27 05:06:43 +00:00
Static file doc improvements (#467)
* Adds new page regarding serving static and media files * Updated doc links
This commit is contained in:
parent
6765031fb1
commit
7ced6adc1e
@ -186,6 +186,9 @@ InvenTree requires some external directories for storing files:
|
||||
| INVENTREE_MEDIA_ROOT | media_root | Allow all remote URLS for CORS checks | *Not specified* |
|
||||
| INVENTREE_BACKUP_DIR | backup_dir | List of whitelisted CORS URLs | *Not specified* |
|
||||
|
||||
!!! tip "Serving Files"
|
||||
Read the [Serving Files](./serving_files.md) section for more information on hosting *static* and *media* files
|
||||
|
||||
### Static File Storage
|
||||
|
||||
Static files **require** a local directory for storage. This directory should be specified with the `static_root` option in the config file based on the particular installation requirements.
|
||||
|
@ -32,8 +32,8 @@ A sample [docker compose file](https://github.com/inventree/InvenTree/blob/maste
|
||||
|
||||
The sample docker compose configuration outlined on this page uses nginx to serve static files and media files. If you change this configuration, you will need to ensure that static and media files are served correctly.
|
||||
|
||||
!!! warning "Debug Warning"
|
||||
When running with `debug=False`, django *will not serve static and media files* - refer to the [django documentation](https://docs.djangoproject.com/en/dev/howto/static-files/).
|
||||
!!! info "Read More"
|
||||
Refer to the [Serving Files](./serving_files.md) section for more details
|
||||
|
||||
#### Required Files
|
||||
|
||||
|
@ -65,10 +65,16 @@ In addition to the location where the InvenTree source code is located, you will
|
||||
|
||||
InvenTree requires a directory for storage of [static files](./config.md#static-file-storage).
|
||||
|
||||
!!! info "Read More"
|
||||
Refer to the [Serving Files](./serving_files.md) section for more details
|
||||
|
||||
#### Media Files
|
||||
|
||||
InvenTree requires a directory for storage of [user uploaded files](./config.md#uploaded-file-storage)
|
||||
|
||||
!!! info "Read More"
|
||||
Refer to the [Serving Files](./serving_files.md) section for more details
|
||||
|
||||
#### Backup Directory
|
||||
|
||||
Location for storing [database backups](./config.md#backup-file-storage)
|
||||
|
@ -156,22 +156,8 @@ So, for a production setup, you should set `INVENTREE_DEBUG=false` in the [confi
|
||||
|
||||
### Potential Issues
|
||||
|
||||
However, turning off DEBUG mode creates further work for the system administrator. In particular, when running in DEBUG mode, the InvenTree web server natively manages *static* and *media* files, which means that the InvenTree server can run "monolithically" without the need for a separate web server.
|
||||
Turning off DEBUG mode creates further work for the system administrator. In particular, when running in DEBUG mode, the InvenTree web server natively manages *static* and *media* files, which means that the InvenTree server can run "monolithically" without the need for a separate web server.
|
||||
|
||||
With DEBUG mode turned off, a separate web server is required for serving *static* and *media* files. You can find further information in the [django documentation](https://docs.djangoproject.com/en/dev/howto/static-files/deployment/).
|
||||
!!! info "Read More"
|
||||
Refer to the [Serving Files](./serving_files.md) section for more details
|
||||
|
||||
There are *many* different ways that a sysadmin might wish to handle this.
|
||||
|
||||
The [docker production example](./docker_prod.md) provides an example using [Nginx](https://www.nginx.com/) to serve *static* and *media* files, and redirecting other requests to the InvenTree web server itself.
|
||||
|
||||
You may use this as a jumping off point, or use an entirely different server setup.
|
||||
|
||||
#### Static Files
|
||||
|
||||
Static files can be served without any need for authentication. In fact, they must be accessible *without* authentication, otherwise the unauthenticated views (such as the login screen) will not function correctly.
|
||||
|
||||
#### Media Files
|
||||
|
||||
It is highly recommended that the *media* files are served in such a way that user authentication is required.
|
||||
|
||||
Refer to the [docker production example](./docker_prod.md) for a demonstration of using nginx to serve media files only to authenticated users, and forward authentication requests to the InvenTree web server.
|
||||
|
@ -93,6 +93,13 @@ The process status can be viewed [in your web browser](http://localhost:9001).
|
||||
|
||||
The InvenTree server (and background task manager) should now be running!
|
||||
|
||||
### Static and Media Files
|
||||
|
||||
In addition to the InvenTree server, you will need a method of delivering static and media files (this is *not* handled by the InvenTree server in a production environment).
|
||||
|
||||
!!! info "Read More"
|
||||
Refer to the [Serving Files](./serving_files.md) section for more details
|
||||
|
||||
### Next Steps
|
||||
|
||||
You (or your system administrator) may wish to perform further steps such as placing the InvenTree server behind a reverse-proxy such as [nginx](https://www.nginx.com/).
|
||||
|
28
docs/start/serving_files.md
Normal file
28
docs/start/serving_files.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Serving Static and Media Files
|
||||
---
|
||||
|
||||
## Serving Files
|
||||
|
||||
In production, the InvenTree web server software *does not* provide hosting of static files, or user-uploaded (media) files.
|
||||
|
||||
When running in [production mode](./production.md) (i.e. the `INVENTREE_DEBUG` flag is disabled), a separate web server is required for serving *static* and *media* files. In `DEBUG` mode, the django webserver facilitates delivery of *static* and *media* files, but this is explicitly not suitable for a production environment.
|
||||
|
||||
!!! into "Read More"
|
||||
You can find further information in the [django documentation](https://docs.djangoproject.com/en/dev/howto/static-files/deployment/).
|
||||
|
||||
There are *many* different ways that a sysadmin might wish to handle this - and it depends on your particular installation requirements.
|
||||
|
||||
The [docker production example](./docker_prod.md) provides an example using [Nginx](https://www.nginx.com/) to serve *static* and *media* files, and redirecting other requests to the InvenTree web server itself.
|
||||
|
||||
You may use this as a jumping off point, or use an entirely different server setup.
|
||||
|
||||
#### Static Files
|
||||
|
||||
Static files can be served without any need for authentication. In fact, they must be accessible *without* authentication, otherwise the unauthenticated views (such as the login screen) will not function correctly.
|
||||
|
||||
#### Media Files
|
||||
|
||||
It is highly recommended that the *media* files are served in such a way that user authentication is required.
|
||||
|
||||
Refer to the [docker production example](./docker_prod.md) for a demonstration of using nginx to serve media files only to authenticated users, and forward authentication requests to the InvenTree web server.
|
@ -72,6 +72,7 @@ nav:
|
||||
- Installer: start/installer.md
|
||||
- Development: start/development.md
|
||||
- Production: start/production.md
|
||||
- Serving Files: start/serving_files.md
|
||||
- Data Backup: start/backup.md
|
||||
- Migrating Data: start/migrate.md
|
||||
- Parts:
|
||||
|
Loading…
x
Reference in New Issue
Block a user