Added honcho and frontend assets watching. Also added inv start.
This commit is contained in:
Родитель
afc46f1471
Коммит
152c53d499
|
@ -0,0 +1,2 @@
|
|||
web: /app/dockerpythonvenv/bin/python network-api/manage.py runserver 0.0.0.0:8000
|
||||
frontend: npm run watch
|
|
@ -10,6 +10,7 @@ mypy
|
|||
ptvsd
|
||||
types-python-slugify
|
||||
types-requests
|
||||
honcho
|
||||
|
||||
pytest
|
||||
pytest-django
|
||||
|
|
|
@ -64,6 +64,8 @@ execnet==1.9.0
|
|||
# via pytest-xdist
|
||||
flake8==3.9.2
|
||||
# via -r dev-requirements.in
|
||||
honcho==1.1.0
|
||||
# via -r dev-requirements.in
|
||||
html-tag-names==0.1.2
|
||||
# via djlint
|
||||
html-void-elements==0.1.0
|
||||
|
|
|
@ -14,7 +14,9 @@ services:
|
|||
- CHOKIDAR_INTERVAL=2000
|
||||
env_file:
|
||||
- ".env"
|
||||
command: /app/dockerpythonvenv/bin/python network-api/manage.py runserver 0.0.0.0:8000
|
||||
# The honcho command is defined in the Procfile.dev file
|
||||
# This command starts the Django server and the frontend build process
|
||||
command: honcho -f Procfile.dev start
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "8001:8001" # ptvsd port for debugging
|
||||
|
@ -26,10 +28,12 @@ services:
|
|||
- ./network-api:/app/network-api:rw
|
||||
- ./.env:/app/.env:rw
|
||||
- ./tests:/app/tests:rw
|
||||
- ./Procfile.dev:/app/Procfile.dev:rw
|
||||
- ./pyproject.toml:/app/pyproject.toml:rw
|
||||
- ./release-steps.sh:/app/release-steps.sh:rw
|
||||
- ./requirements.txt:/app/requirements.txt:rw
|
||||
- ./requirements.in:/app/requirements.in:rw
|
||||
- ./dev-requirements.txt:/app/dev-requirements.txt:rw
|
||||
- ./dev-requirements.in:/app/dev-requirements.in:rw
|
||||
|
||||
# Frontend config
|
||||
- ./source:/app/source:rw
|
||||
|
|
13
tasks.py
13
tasks.py
|
@ -168,7 +168,14 @@ def setup(ctx):
|
|||
print("* Building Docker images")
|
||||
ctx.run("docker-compose build")
|
||||
initialize_database(ctx)
|
||||
print("\n* Start your dev server with:\n docker-compose up")
|
||||
print("\n* Start your dev server with:\n inv start or docker-compose up")
|
||||
|
||||
|
||||
@task(aliases=["start", "docker-start"])
|
||||
def startdev(ctx):
|
||||
"""Start the dev server"""
|
||||
with ctx.cd(ROOT):
|
||||
ctx.run("docker-compose up")
|
||||
|
||||
|
||||
# Javascript shorthands
|
||||
|
@ -176,14 +183,14 @@ def setup(ctx):
|
|||
def npm(ctx, command):
|
||||
"""Shorthand to npm. inv docker-npm \"[COMMAND] [ARG]\" """
|
||||
with ctx.cd(ROOT):
|
||||
ctx.run(f"docker-compose run --rm watch-static-files npm {command}")
|
||||
ctx.run(f"docker-compose run --rm backend npm {command}")
|
||||
|
||||
|
||||
@task(aliases=["docker-npm-install"])
|
||||
def npm_install(ctx):
|
||||
"""Install Node dependencies"""
|
||||
with ctx.cd(ROOT):
|
||||
ctx.run("docker-compose run --rm watch-static-files npm ci")
|
||||
ctx.run("docker-compose run --rm backend npm ci")
|
||||
|
||||
|
||||
@task(aliases=["copy-stage-db"])
|
||||
|
|
Загрузка…
Ссылка в новой задаче