-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env python | ||
|
||
|
||
from .core import PyPIPackageProject # noqa: F401 | ||
|
||
__name__ = "PyPIPackageProjectTemplate" | ||
__version__ = "0.x.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python | ||
|
||
|
||
""" | ||
The main entry point. Invoke as `python_module_project' or | ||
`python -m python_module_project'. | ||
""" | ||
|
||
import sys | ||
|
||
|
||
def main(): | ||
try: | ||
from .cli import main as cli_main | ||
|
||
sys.exit(cli_main()) | ||
except KeyboardInterrupt: | ||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import os | ||
import sys | ||
from logging import getLogger | ||
|
||
import click | ||
import uvicorn | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
@click.group() | ||
def cli(**cli_kwargs): | ||
# do something | ||
return | ||
|
||
|
||
@cli.command("runserver") | ||
@click.option( | ||
"-H", | ||
"--host", | ||
default="127.0.0.1", | ||
help="Bind socket to this host. [default: 127.0.0.1]", | ||
) | ||
@click.option( | ||
"-P", "--port", default=8000, help="Bind socket to this port. [default: 8000]" | ||
) | ||
def runserver(**cli_kwargs): | ||
kwargs = { | ||
"app": "ddns_clienter.asgi:application", | ||
# "host": host, | ||
# "port": port, | ||
"lifespan": "off", | ||
"log_level": "info", | ||
"access_log": False, | ||
} | ||
kwargs.update(cli_kwargs) | ||
|
||
return uvicorn.run(**kwargs) | ||
|
||
|
||
@cli.command("check_and_push") | ||
@click.option("-C", "--config", required=True, type=str, help="config.toml") | ||
def check_and_push(**cli_kwargs): | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ddns_clienter.settings") | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
def main(): | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env python | ||
|
||
|
||
class PyPIPackageProject: | ||
pass |