update Makefile and support for install by make

This commit is contained in:
pycook
2019-11-12 11:55:04 +08:00
parent 42bcc2e510
commit 39153e92d1
2 changed files with 47 additions and 13 deletions

View File

@@ -1,25 +1,37 @@
.PHONY: docs test
.PHONY: env clean api ui worker
help:
@echo " env create a development environment using virtualenv"
@echo " env create a development environment using pipenv"
@echo " deps install dependencies using pip"
@echo " clean remove unwanted files like .pyc's"
@echo " lint check style with flake8"
@echo " test run all your tests using py.test"
@echo " api start api server"
@echo " ui start ui server"
@echo " worker start async tasks worker"
env:
sudo easy_install pip && \
pip install pipenv &&
pip install pipenv -i https://pypi.douban.com/simple && \
npm install yarn && \
make deps
deps:
pipenv install --dev
pipenv install --dev && \
pipenv run flask db-setup && \
pipenv run flask init-cache && \
cd ui && yarn install && cd ..
api:
pipenv run flask run -h 0.0.0.0
worker:
pipenv run celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1
ui:
cd ui && yarn run serve
clean:
python manage.py clean
pipenv run flask clean
lint:
flake8 --exclude=env .
test:
py.test tests