Giter Club home page Giter Club logo

sanic-admin's Introduction

sanic-admin

sanic-admin is a command line tool for automatically restarting sanic.
The code(*.py) under the current working directory is changed, sanic will automatically restart.

Installation

pip install sanic-admin

Usage

Auto reload

sanic-admin server.py

Display urls

sanic-admin -urls server.py

Setting

You can change the behavior of sanic-admin by putting a file named sanic-admin.json in current working directory like the contents below.

{
    // Patterns of filename to be watched
    // default ["*.py"]
    "patterns": ["*.html", "*.css", "*.py"],
    // Paths to be watched
    // default current working directory
    "paths": ["/foo1/bar1", "/foo2/bar2"],
    // File to be executed when sanic-admin starts
    // default None
    "before": "before.py",
    // File to be executed before sanic restarts
    // default None
    "before_each": "before_each.py",
    // File to be executed when sanic-admin exits
    // default None
    "after": "after.py",
    // File to be executed after sanic restarts
    // default None
    "after_each": "after_each.py",
    // Variable name of sanic instance 
    // default "app" 
    "app": "app"
}

sanic-admin's People

Contributors

38elements avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sanic-admin's Issues

Can't import blueprints with -urls

Hi!
I'm trying to use your reloaded (it was about time to sanic ecosystem, so thanks a lot) and I am intriged with the -urls so I've activated them to take a peek
This is the result with a code that works without the -urls activated (so the only change was -urls)

Traceback (most recent call last):
  File "/Users/garito/Lab/sanic/testRestAPI2/env/bin/sanic-admin", line 11, in <module>
    load_entry_point('sanic-admin==0.0.6', 'console_scripts', 'sanic-admin')()
  File "/Users/garito/Lab/sanic/testRestAPI2/env/lib/python3.6/site-packages/sanic_admin/entry_point.py", line 34, in run
    sanic_admin.urls.run(setting)
  File "/Users/garito/Lab/sanic/testRestAPI2/env/lib/python3.6/site-packages/sanic_admin/urls.py", line 12, in run
    loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "app.py", line 6, in <module>
    from bps.user import bp as userBP
ModuleNotFoundError: No module named 'bps'

Are you aware?
How can I help?

Thanks and I hope this library will have success

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.