Last active
January 13, 2020 15:03
-
-
Save jefftriplett/7c3684361b8e2d71bb3a35f82ab4c4d6 to your computer and use it in GitHub Desktop.
My setup for: Modd, Python, Django, TailwindCSS, Black, and pytest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update project requirements when requirements.txt changes. | |
requirements.txt { | |
prep +onchange: "pip install -U -r requirements.txt" | |
} | |
../.envrc { | |
prep +onchange: "direnv allow" | |
} | |
**/index.css **/tailwind.config.js { | |
prep +onchange: "make static" | |
} | |
# Whenever a Django Model file changes, create and apply our migrations. | |
**/models.py { | |
prep +onchange: " | |
echo @mods | |
python manage.py makemigrations | |
python manage.py migrate | |
" | |
} | |
# Run the test suite if a source or test file changes | |
**/tests/test_*.py { | |
# prep +onchange: pytest @dirmods | |
prep +onchange: pytest @mods | |
} | |
# Restart runserver when we update: config, apps, or signals. | |
config/*.py | |
**/apps.py | |
**/signals.py | |
!**/models.py | |
!**/tests/test_*.py | |
{ | |
daemon: "python manage.py runserver" | |
} | |
**/*.py { | |
prep +onchange: "black ." | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In theory, this would work for Docker if that's your jam. | |
# Update project requirements when requirements.txt changes. | |
requirements.txt { | |
prep +onchange: "docker-compose build" | |
} | |
# Whenever a Django Model file changes, create and apply our migrations. | |
**/models.py { | |
prep +onchange: " | |
echo @mods | |
docker-compose run web python manage.py makemigrations | |
docker-compose run web python manage.py migrate | |
" | |
} | |
# Run the test suite if a source or test file changes | |
**/tests/test_*.py { | |
# prep +onchange: "docker-compose run web pytest @dirmods" | |
prep +onchange: "docker-compose run web pytest @mods" | |
} | |
# Restart runserver when we update: config, apps, or signals. | |
config/*.py | |
**/apps.py | |
**/signals.py | |
!**/models.py | |
!**/tests/test_*.py | |
{ | |
daemon: "docker-compose up" | |
} | |
**/*.py { | |
prep +onchange: "docker-compose run web black ." | |
} | |
**/index.css **/tailwind.config.js { | |
prep +onchange: " | |
docker-compose run web npx tailwindcss build ./frontend/index.css --config ./frontend/tailwind.config.js --output ./frontend/output.css | |
docker-compose run web python manage.py collectstatic --noinput | |
" | |
} | |
# ../.envrc { | |
# prep +onchange: "direnv allow" | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment