-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
62 lines (39 loc) · 1.57 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from typing import Any
from invoke import task
@task
def test(context: Any) -> None:
context.run("pipenv run pytest tests/")
@task
def unittests(context: Any) -> None:
context.run("pipenv run pytest tests/test_unit --create-db")
@task
def frontendtests(context: Any) -> None:
context.run("pipenv run pytest tests/test_frontend --browser firefox")
@task
def testserver(context: Any) -> None:
context.run("pipenv run python django_app/manage.py runserver --settings=config.settings.test")
@task
def makemigrations(context: Any) -> None:
print("Running manage.py makemigrations")
context.run("pipenv run python django_app/manage.py makemigrations")
@task
def migrate(context: Any) -> None:
print("Running manage.py migrate")
base_command = "pipenv run python django_app/manage.py migrate"
context.run(base_command)
@task
def runserver(context: Any, port_number: int = 8000) -> None:
context.run(f"pipenv run python django_app/manage.py runserver {port_number}", hide=False, pty=True)
@task
def createsuperuser(context: Any) -> None:
context.run("pipenv run python django_app/manage.py createsuperuser", hide=False, pty=True)
@task
def collectstatic(context: Any) -> None:
context.run("pipenv run python django_app/manage.py collectstatic --no-input", hide=False, pty=True)
@task
def black(context: Any, directory: str = ".") -> None:
print("Running black formatting")
context.run(f"pipenv run black {directory}")
@task
def mypy(context: Any, module: str = "django_app") -> None:
context.run(f"mypy {module}", hide=False, pty=True)