django-livereload-server


Namedjango-livereload-server JSON
Version 0.4 PyPI version JSON
download
home_pagehttps://github.com/tjwalch/django-livereload-server
SummaryLiveReload functionality integrated with your Django development environment
upload_time2021-12-14 08:46:08
maintainer
docs_urlNone
authorTomas Walch
requires_python
licenseBSD License
keywords django server runserver livereload
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ========================
django-livereload-server
========================

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_CLASSES`` (probably at the end)::

    MIDDLEWARE_CLASSES = (
        ...
        '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 <https://github.com/lepture/python-livereload>`_ and
`django-livereload <https://github.com/Fantomas42/django-livereload>`_, excellent projects both and even better for
smooth django development when combined.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tjwalch/django-livereload-server",
    "name": "django-livereload-server",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django,server,runserver,livereload",
    "author": "Tomas Walch",
    "author_email": "tomaswalch@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/59/515d6a32b9d7339ec6cfd523b2c3c93269ced1bcbbba952189d3e0bbd610/django-livereload-server-0.4.tar.gz",
    "platform": "",
    "description": "========================\ndjango-livereload-server\n========================\n\nThis django app adds a management command that starts a livereload server watching all your static files and templates as well\nas a custom ``runserver`` command that issues livereload requests when the development server is ready after a restart.\n\nInstallation\n------------\n\nInstall package: ::\n\n  $ pip install django-livereload-server\n\nAdd ``'livereload'`` to the ``INSTALLED_APPS``, before ``'django.contrib.staticfiles'`` if this is used::\n\n    INSTALLED_APPS = (\n        ...\n        'livereload',\n        ...\n    )\n\nNext you need to inject the loading of the livereload javascript. You can do this in one of two ways:\n\n* Through middleware by adding  ``'livereload.middleware.LiveReloadScript'`` to ``MIDDLEWARE_CLASSES`` (probably at the end)::\n\n    MIDDLEWARE_CLASSES = (\n        ...\n        'livereload.middleware.LiveReloadScript',\n    )\n\n* Through a templatetag in your ``base.html`` (or similar) template::\n\n    {% load livereload_tags %}\n    ...\n    {% livereload_script %}\n    </head>\n\nEither of these options will inject the ``livereload.js`` script into your webpages if ``DEBUG`` setting is on.\n\nConfiguration\n-------------\nIf you need the livereload server to use a different host and port than the default 127.0.0.1 and 35729,\nspecify them by setting ``LIVERELOAD_HOST`` and ``LIVERELOAD_PORT`` in ``settings.py``.\n\nUsage\n-----\nStart the livereload server::\n\n  $ python manage.py livereload\n\nkeep the livereload server running.\n\nStart the django development server as usual (in another console)::\n\n  $ python manage.py runserver\n\nIn the browser's address bar access your web app by doing:\n\n  127.0.0.1:8000 or localhost:8000\n\nnow every time you hit save in your editor, the django-development-server/livereload-server automatically updates the staticfiles\n\nCustomization\n-------------\n\nBy default both template and staticfiles directories are watched.\n\nYou can ignore template directories using: ::\n\n  $ ./manage.py livereload --ignore-template-dirs\n\nOr staticfiles directories using: ::\n\n  $ ./manage.py livereload --ignore-static-dirs\n\nYou can ignore file extensions: ::\n\n  $ ./manage.py livereload --ignore-file-extensions=.less,.scss\n\n\nExtra 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. ::\n\n  $ python manage.py livereload path/to/my-extra-directory/\n\nThis will be excluded from the paths ignored by `--ignore-template-dirs` and\n`--ignore-static-dirs`.\n\nHost and port can be overridden with ``--host`` and ``--port`` options. ::\n\n  $ python manage.py livereload --host=myhost.com --port=9090\n\nthe runserver command ``python manage.py runserver`` also accepts three additional options::\n\n* ``--nolivereload`` to disable livereload functionality\n* ``--livereload-host`` to override both default and settings file specified host address\n* ``--livereload-port`` to override both default and settings file specified port\n\nBackground\n----------\nThis project is based on a merge of `python-livereload <https://github.com/lepture/python-livereload>`_ and\n`django-livereload <https://github.com/Fantomas42/django-livereload>`_, excellent projects both and even better for\nsmooth django development when combined.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "LiveReload functionality integrated with your Django development environment",
    "version": "0.4",
    "project_urls": {
        "Homepage": "https://github.com/tjwalch/django-livereload-server"
    },
    "split_keywords": [
        "django",
        "server",
        "runserver",
        "livereload"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c682cb0a2d9a6821fb0ea45c2dd6676d9c6749aa5b8463332a2667dd64c3189a",
                "md5": "8b8d903b5a1083e4a4e787694534b5ef",
                "sha256": "136c231e7ad3ba7a4db65426632dfa9b964ac04e8fa5f3808166447f016a4a91"
            },
            "downloads": -1,
            "filename": "django_livereload_server-0.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8b8d903b5a1083e4a4e787694534b5ef",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 22275,
            "upload_time": "2021-12-14T08:46:06",
            "upload_time_iso_8601": "2021-12-14T08:46:06.673067Z",
            "url": "https://files.pythonhosted.org/packages/c6/82/cb0a2d9a6821fb0ea45c2dd6676d9c6749aa5b8463332a2667dd64c3189a/django_livereload_server-0.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb59515d6a32b9d7339ec6cfd523b2c3c93269ced1bcbbba952189d3e0bbd610",
                "md5": "efbbb7647a506bde38e3012a1b5bef3c",
                "sha256": "60ed030085ca53671d25704b10ec7aa3cc94a16da437b727a8dcce42471b4c65"
            },
            "downloads": -1,
            "filename": "django-livereload-server-0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "efbbb7647a506bde38e3012a1b5bef3c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19656,
            "upload_time": "2021-12-14T08:46:08",
            "upload_time_iso_8601": "2021-12-14T08:46:08.180016Z",
            "url": "https://files.pythonhosted.org/packages/fb/59/515d6a32b9d7339ec6cfd523b2c3c93269ced1bcbbba952189d3e0bbd610/django-livereload-server-0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-12-14 08:46:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tjwalch",
    "github_project": "django-livereload-server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-livereload-server"
}
        
Elapsed time: 0.13152s