Scripts
General
Create a file without extension in usr/local/bin (scripts are reached globally from that location)
Structure you file as such
#!/usr/bin/env zsh pipenv install flake8 --dev pipenv install black --dev --pre pipenv install pylint-django --dev pipenv install autopep8 --dev pipenv install django mkdir .vscode touch .vscode/settings.json touch .env echo '{ "python.linting.pylintArgs": [ "--load-plugins=pylint_django", "--load-plugins=pylint_django.checkers.migrations", "--load-plugins", "pylint_django", "--load-plugins", "pylint_django.checkers.migrations", "--disable=C0114, C0115, W0222", "--disable=imported-auth-user", "--disable=invalid-name", "--disable=line-too-long", "--disable=too-many-ancestors", "--django-settings-module=<YOUR_DJANGO_APP>.settings", // "--disable=django-not-configured" ], "[django-html]": { "editor.defaultFormatter": "HookyQR.beautify", "editor.quickSuggestions": { "comments": true, "other": true, "strings": true }, "editor.tabSize": 4, "editor.wordWrap": "on" }, "beautify.language": { "html": [ "django-html", "html", "jinja", "jinja-html" ] }, "emmet.includeLanguages": { "django-html": "html", "javascript": "javascriptreact", "jinja-html": "html" }, "files.associations": { "**/templates/**/*": "django-txt", "**/templates/**/*.html": "django-html", }, "html-css-class-completion.HTMLLanguages": [ "django-html", ] }' >> .vscode/settings.json echo 'SECRET_KEY=your_very_secret_key' >> .env pipenv shell
In this example, the script:
- Creates a django environment
- Installs dev dependencies
- Creates a workspace settings.json and
- Adds Django configuration and
- Creates a bare .env file
Give the file permissions by executing in the directory
chmod +x <filename>
The script now is globally executable and will create the environment and requested files in the directory from which it is invoked.
Backlinks
Knowledge Base
- [[script-django]]