From c49258af84112e0aace36732c34e11b2e1f7b7bd Mon Sep 17 00:00:00 2001 From: plup <plup@plup.io> Date: Sun, 29 Mar 2020 15:44:08 +0200 Subject: [PATCH] feature: added runserver command for djangoldp --- djangoldp/cli.py | 15 +++++++++++++++ djangoldp/management/commands/configure.py | 2 +- djangoldp/templates/development/config.yml | 3 --- docs/using_client.md | 9 +++++---- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/djangoldp/cli.py b/djangoldp/cli.py index dc95df7e..5f034d0f 100644 --- a/djangoldp/cli.py +++ b/djangoldp/cli.py @@ -88,3 +88,18 @@ def configure(): except subprocess.CalledProcessError as e: click.echo(f'Configuration error: {e}') + + +@main.command() +def runserver(): + + """Run the Django embeded webserver.""" + + try: + # shortcut to the djangoldp.management command + path = str(Path.cwd() / 'manage.py') + cmd = [sys.executable, path, 'runserver', '0.0.0.0:8000'] + subprocess.run(cmd).check_returncode() + + except subprocess.CalledProcessError as e: + click.echo(f'Execution error: {e}') diff --git a/djangoldp/management/commands/configure.py b/djangoldp/management/commands/configure.py index 3639c75f..d43dec62 100644 --- a/djangoldp/management/commands/configure.py +++ b/djangoldp/management/commands/configure.py @@ -6,7 +6,7 @@ from django.core.exceptions import ValidationError class Command(BaseCommand): - help = 'Install server dependencies' + help = 'Initialize the DjangoLDP backend' def handle(self, *args, **options): diff --git a/djangoldp/templates/development/config.yml b/djangoldp/templates/development/config.yml index 81bf5ae6..bde0c477 100644 --- a/djangoldp/templates/development/config.yml +++ b/djangoldp/templates/development/config.yml @@ -5,6 +5,3 @@ dependencies: ldppackages: - djangoldp_account - oidc_provider - -server: - site_url: 'https://localhost:8000' diff --git a/docs/using_client.md b/docs/using_client.md index ddb64aa5..0b75d685 100644 --- a/docs/using_client.md +++ b/docs/using_client.md @@ -1,16 +1,17 @@ # Using the client +Setup the project: ``` -# docker run --rm -v $PWD:/code -w /code -it python:3.6 bash +# docker run --rm -v $PWD:/code -w /code -p 127.0.0.1:8000:8000 -it python:3.6 bash # pip install . # cd /tmp/ -# djangoldp start myproject +# djangoldp startproject myproject # cd myproject # djangoldp install # djangoldp configure ``` -Play with the installation: +Play with it: ``` -# python manage.py runserver +# djangoldp runserver ``` -- GitLab