This django app adds a management command that starts a livereload server watching all your static files and templates as well as a custom runserver command that issues livereload requests when the development server is ready after a restart.
Installation
Install package:
$ pip install django-livereload-server
Add 'livereload' to the INSTALLED_APPS, before 'django.contrib.staticfiles' if this is used:
INSTALLED_APPS = (
...
'livereload',
...
)
Next you need to inject the loading of the livereload javascript. You can do this in one of two ways:
Through middleware by adding 'livereload.middleware.LiveReloadScript' to MIDDLEWARE (probably at the end):
MIDDLEWARE = ( ... 'livereload.middleware.LiveReloadScript', )Through a templatetag in your base.html (or similar) template:
{% load livereload_tags %} ... {% livereload_script %} </head>
Either of these options will inject the livereload.js script into your webpages if DEBUG setting is on.
Configuration
If you need the livereload server to use a different host and port than the default 127.0.0.1 and 35729, specify them by setting LIVERELOAD_HOST and LIVERELOAD_PORT in settings.py.
Usage
Start the livereload server:
$ python manage.py livereload
keep the livereload server running.
Start the django development server as usual (in another console):
$ python manage.py runserver
In the browser’s address bar access your web app by doing:
127.0.0.1:8000 or localhost:8000
now every time you hit save in your editor, the django-development-server/livereload-server automatically updates the staticfiles
Customization
By default both template and staticfiles directories are watched.
You can ignore template directories using:
$ ./manage.py livereload --ignore-template-dirs
Or staticfiles directories using:
$ ./manage.py livereload --ignore-static-dirs
You can ignore file extensions:
$ ./manage.py livereload --ignore-file-extensions=.less,.scss
Extra files and/or paths to watch for changes can be added as positional arguments. By default livereload server watches the files that are found by your staticfiles finders and your template loaders.
$ python manage.py livereload path/to/my-extra-directory/
This will be excluded from the paths ignored by –ignore-template-dirs and –ignore-static-dirs.
Host and port can be overridden with --host and --port options.
$ python manage.py livereload --host=myhost.com --port=9090
the runserver command python manage.py runserver also accepts three additional options:
* ``--nolivereload`` to disable livereload functionality * ``--livereload-host`` to override both default and settings file specified host address * ``--livereload-port`` to override both default and settings file specified port
Background
This project is based on a merge of python-livereload and django-livereload, excellent projects both and even better for smooth django development when combined.
Metadata
Release files for django-livereload-server 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-livereload-server-0.5.1.tar.gz | 23.1 kB | Without provenance | Details for django-livereload-server-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_livereload_server-0.5.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_livereload_server-0.5.1-py2.py3-none-any.whl |
Total release size: 49.0 kB
Release files / django-livereload-server-0.5.1.tar.gz
| Download URL | django-livereload-server-0.5.1.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1fecca2a74ec87235bbfdf8b63365499324d9a87017427e5d297711d1cd532d
|
|
BLAKE2b-256 checksum How to use checksums |
7956313c43b871d4cc167260faf2924a72ffa9105cdd78faf028341338115800
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / django_livereload_server-0.5.1-py2.py3-none-any.whl
| Download URL | django_livereload_server-0.5.1-py2.py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e03bd65d1679ef1b4a5e22e2a77d11d3cfb0e3d21ae25afba49e280924ba6f58
|
|
BLAKE2b-256 checksum How to use checksums |
8ccd77566526193cb49e805bd33a6b982ba5a39f3a7f828dd6647a76bf977f3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for django-livereload-server 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.