Skip to content
Snippets Groups Projects
Select Git revision
  • 990b25f330614c653ed25a64db45511fd424b90f
  • test default
  • master protected
3 results

Makefile

Blame
  • user avatar
    Tomáš Valenta authored
    5ca51022
    History
    Makefile 1.59 KiB
    #!/usr/bin/make -f
    
    PYTHON   = python3.11
    VENV     = .venv
    PORT     = 8013
    SETTINGS = registry.settings.dev
    
    .PHONY: help venv install install-hooks hooks build run shell migrations migrate
    
    help:
    	@echo "Setup:"
    	@echo "  venv           Setup virtual environment"
    	@echo "  install        Install dependencies to venv"
    	@echo "  install-hooks  Install pre-commit hooks"
    	@echo "  hooks          Run pre-commit hooks manually"
    	@echo "  build          Build CSS and JS files"
    	@echo ""
    	@echo "Application:"
    	@echo "  run            Run the application on port ${PORT}"
    	@echo "  shell          Access the Django shell"
    	@echo "  sync           Sync with the old contract registry"
    	@echo ""
    	@echo "Database:"
    	@echo "  migrations     Generate migrations"
    	@echo "  migrate        Run migrations"
    
    venv: .venv/bin/python
    .venv/bin/python:
    	${PYTHON} -m venv ${VENV}
    
    install: venv
    	${VENV}/bin/pip install -r requirements/base.txt -r requirements/production.txt
    	npm install
    
    install-hooks:
    	pre-commit install --install-hooks
    
    hooks:
    	pre-commit run -a
    
    build: venv
    	npm run build
    	${VENV}/bin/python manage.py collectstatic --noinput --settings=${SETTINGS}
    
    run: venv
    	${VENV}/bin/python manage.py runserver ${PORT} --settings=${SETTINGS}
    
    shell: venv
    	${VENV}/bin/python manage.py shell --settings=${SETTINGS}
    
    sync:
    	${VENV}/bin/python manage.py import_old_contracts https://github.com/pirati-web/smlouvy.pirati.cz.git gh-pages --settings=${SETTINGS} --delete -v 3
    
    migrations: venv
    	${VENV}/bin/python manage.py makemigrations --settings=${SETTINGS}
    
    migrate: venv
    	${VENV}/bin/python manage.py migrate --settings=${SETTINGS}