In the continuation of the post “Creating dockerized Django app with VSCode”, I updated the source code to work with GitHub Actions.
Setup a basic workflow using GitHub Actions Add to the requirements.txt file the following line to check with linter:
flake8>=3.9.2,<3.10 Create a new file at .github/workflows/cd.yml and fill it with the following contents:
--- name: Code checks on: push: branches: [ master ] pull_request: branches: [ master ] jobs: test: name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Test run: docker-compose run --rm . sh -c "python manage.py test" lint: name: Lint runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Lint run: docker-compose run --rm . sh -c "flake8" To add a cool badge I updated README.md with the following link:
...
Thanks to Mark Winterbottom for the interesting videos and the idea for this post.
Creating a Django project Start by creating a new directory for your project (eg: vscode-django-docker), and open it in VSCode.
mkdir vscode-django-docker cd vscode-django-docker git init code . Then, add a .gitignore for your project. You can use template for Python provided by GitHub or generate on gitignore.io.
Now let’s create a Django project by running the one-line-command below
...
A cool feature of PyCharm is the fast creating an html template. Create a new file, type html:5, press Tab. That’s all.
I found out how to use pipenv environment with VS Code from the article “Visual Studio Code, Python and pipenv”. Thanks, Benjamin Pack! I saved the text for myself.
First, find out where pipenv has created your virtualenv setup and stashed the python executable you are using. From the command line in your project folder (where your Pipfile is), execute the following:
pipenv --py
This will give you the full path to your virtualenv python install. For my sample project it was /Users/pack/.local/share/virtualenvs/astra-AQkAm5fD/bin/python
...
Pyenv pyenv lets you easily install and switch between multiple versions of Python.
Install and customization zsh The main issues are described in wiki
curl https://pyenv.run | bash echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc exec $SHELL sudo apt-get update; sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev Update pyenv
...