Skip to main content

Provides easy way to reload you server on code changes or another events

Project description

Server Reloader
===============

It is common task in all web frameworks — to provide an easy way to reload development
server on code changes. Most of these frameworks are carrying a reloader's code with
themselves. And there isn't any python module, simple enougth to use in a small project.

Some times ago, I started to write a chat bot called [TheBot][] and begun to look for
a separate server reloader's implementation. And found nothing suitable.

Then, I extracted autoreloader from the Django's codebase and put it into a separate
module, which README you are reading now. Code was partly modified, now it allows
not only to watch on file changes but also to reload upon a some event.

Reload on some event is a quite useful feature for [TheBot][], because now he can update
himself on a push to the GitHub. A pseudocode for this procedure will look like:

def on_push_to_the_github_master_branch():
make_git_pull()
run_pip_install()
trigger_code_reload()

And I don't need an external watcher to run bot, because now he uses [server-reloader][].


Example usage
-------------

Here is a simple example, how to use a reloader.

```python
def run_server():
"""Some function, which creates and runs your server."""
pass

def main():
server_reloader.main(
run_server,
before_reload=lambda: print('Reloading code…')
)

if __name__ == '__main__':
main()
```


If you want to trigger code reloading on some custom event, then just do:

```python
from server_reloader import trigger_reload
trigger_reload()
```


Credentials
-----------

Many thanks to original authors of the autoreloader, I took as the basis.

[TheBot]: http://github.com/svetlyak40wt/thebot
[server-reloader]: http://github.com/svetlyak40wt/server-reloader

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

server-reloader-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file server-reloader-0.1.1.tar.gz.

File metadata

File hashes

Hashes for server-reloader-0.1.1.tar.gz
Algorithm Hash digest
SHA256 540a9f0af7b372f24fe5f8bed6ac28a02239c2f3771ec9ee782f7d1126c47a82
MD5 11ca4c512f8167f743c8889b4e3db5c8
BLAKE2b-256 f1aa4b8b5169e8212a1b2eb04306c22499a27be09a99f7c81101506e7e5f758f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page