-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint
executable file
·46 lines (34 loc) · 884 Bytes
/
entrypoint
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
#!/usr/bin/env python3
import os
import click
import subprocess
@click.group()
def entrypoint():
pass
@entrypoint.command()
def web():
import django
from django.core.management import call_command
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings')
django.setup()
call_command('check', deploy=True)
call_command('collectstatic', interactive=False) # noqa
call_command('migrate')
subprocess.run(['gunicorn', 'main.wsgi'])
@entrypoint.command()
def worker():
subprocess.run([
'celery', '-A', 'main', 'worker', '-l', 'info',
])
@entrypoint.command()
def beat():
subprocess.run([
'celery', '-A', 'main', 'beat', '-l', 'info', '-S', 'django'
])
@entrypoint.command()
def flower():
subprocess.run([
'celery', '-A', 'tasks', 'flower'
])
if __name__ == '__main__':
entrypoint()